KDE Kate Code Editor Folding Broken - Stops folding and unfolding
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3887
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Have you experienced this? I have. Kate is correctly folding, then something goes wrong, could be a crash, could be anything, then suddenly when you open it, a huge file filed with many folding markers is randomly folded, and it won't fold or unfold.

Fear not, the problem is easy to solve, close that Kate session, then simply run these commands from your home directory (~/) in a terminal:

:: Code ::
grep -snR 'Folding=' .local/share/kate/sessions/* | grep -v '\[\]'
# you'll see many .local/share/kate/sessions/[your kate session name].katesession:977:TextFolding=[]
# that's what it looks like when no folding data has been saved.
# then you will see an item that has huge amounts of folding data, like:
.local/share/kate/sessions/[your session name].katesession:984:TextFolding=[{"endColumn":0,"endLine":58,"flags":2,"startColumn":32
# and so on. that's your target.
# to correct, good old sed to the rescue
sed -i 's%TextFolding=\[.*\]%TextFolding=[]%' .local/share/kate/sessions/[your session name].katesession

and that's it, your done. this simply dumps everything that was between the folding [ and ] end brackets, which is the stuck folding data.
Back to top
Display posts from previous:   

All times are GMT - 8 Hours