[frameworks-ktexteditor] [Bug 405197] KTextEditor : patch/.diff file folding broken (again)

2022-09-12 Thread Waqar Ahmed
https://bugs.kde.org/show_bug.cgi?id=405197

Waqar Ahmed  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 CC||waqar@gmail.com
 Resolution|--- |FIXED

--- Comment #11 from Waqar Ahmed  ---
This should now be fixed (5.97).

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 405197] KTextEditor : patch/.diff file folding broken (again)

2019-07-18 Thread RJVB
https://bugs.kde.org/show_bug.cgi?id=405197

RJVB  changed:

   What|Removed |Added

   Severity|normal  |major

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 405197] KTextEditor : patch/.diff file folding broken (again)

2019-07-18 Thread RJVB
https://bugs.kde.org/show_bug.cgi?id=405197

--- Comment #10 from RJVB  ---
Created attachment 121610
  --> https://bugs.kde.org/attachment.cgi?id=121610=edit
folded and non-unfoldable code at startup!

I stumbled onto a much more annoying glitch that I already thought to have
seen: see the screenshot.

This is a document in a KDevelop session I just started, one of those that are
opened on startup.

There is actually code being folded at the indicated location, except that this
location is not at all a proper place for a foldable block to start. The folded
block contains the end of the current class definition, and most of the
following class definition (see below). In other words: `addedContextMenu` is
part of the 1st class definition, `endoding` is a member of the other class.

What's really annoying here is that I cannot unfold it by clicking on the
folding carat. Fortunately "View/Code Folding/Unfold Toplevel Nodes" had the
desired effect.

There is no support for restoring folded sections after closing/reopening a
document that I can see, but apparently these sections are preserved across
restarts the editor, right? If so this could be an effect of changing the
document behind the editor's back.

That is not what can have happened here, but I do notice that folding is
preserved when the document is reloaded (automatically or manually) after an
external change. Evidently that gives weird results, so it'd be good if you
could opt not to preserve folding.

The hidden code (obtained by selecting lines labelled 126-284 in the
screenshot:

```
// can share the same context menu instance.
QMenu* addedContextMenu;
QPointer lastShownMenu;
};

class TextDocumentPrivate
{
public:
explicit TextDocumentPrivate(TextDocument *textDocument, ICore* core)
: q(textDocument)
{
if (!contextMenuData) {
contextMenuData = new
TextDocumentContextMenuData(core->uiController()->activeMainWindow());
}
}

~TextDocumentPrivate()
{
saveSessionConfig();
delete document;
}

void setStatus(KTextEditor::Document* document, bool dirty)
{
QIcon statusIcon;

if (document->isModified())
if (dirty) {
state = IDocument::DirtyAndModified;
statusIcon = QIcon::fromTheme(QStringLiteral("edit-delete"));
} else {
state = IDocument::Modified;
statusIcon = QIcon::fromTheme(QStringLiteral("document-save"));
}
else
if (dirty) {
state = IDocument::Dirty;
statusIcon =
QIcon::fromTheme(QStringLiteral("document-revert"));
} else {
state = IDocument::Clean;
}

q->notifyStateChanged();
Core::self()->uiControllerInternal()->setStatusIcon(q, statusIcon);
}

inline KConfigGroup katePartSettingsGroup() const
{
return KSharedConfig::openConfig()->group("KatePart Settings");
}

inline QString docConfigGroupName() const
{
return document->url().toDisplayString(QUrl::PreferLocalFile);
}

inline KConfigGroup docConfigGroup() const
{
return katePartSettingsGroup().group(docConfigGroupName());
}

void saveSessionConfig()
{
if(document && document->url().isValid()) {
// make sure only MAX_DOC_SETTINGS entries are stored
KConfigGroup katePartSettings = katePartSettingsGroup();
// ordered list of documents
QStringList documents = katePartSettings.readEntry("documents",
QStringList());
// ensure this document is "new", i.e. at the end of the list
documents.removeOne(docConfigGroupName());
documents.append(docConfigGroupName());
// remove "old" documents + their group
while(documents.size() >= MAX_DOC_SETTINGS) {
katePartSettings.group(documents.takeFirst()).deleteGroup();
}
// update order
katePartSettings.writeEntry("documents", documents);

// actually save session config
KConfigGroup group = docConfigGroup();
document->writeSessionConfig(group);
}
}

void loadSessionConfig()
{
if (!document ||
!katePartSettingsGroup().hasGroup(docConfigGroupName())) {
return;
}

document->readSessionConfig(docConfigGroup(),
{QStringLiteral("SkipUrl")});
}

// Determines whether the current contents of this document in the editor
// could be retrieved from the VCS if they were dismissed.
void queryCanRecreateFromVcs(KTextEditor::Document* document) const {
IProject* project = nullptr;
// Find projects by checking which one contains the file's parent
directory,
// to avoid issues with the cmake manager temporarily removing files
from a project
// during reloading.
KDevelop::Path 

[frameworks-ktexteditor] [Bug 405197] KTextEditor : patch/.diff file folding broken (again)

2019-07-17 Thread Christoph Cullmann
https://bugs.kde.org/show_bug.cgi?id=405197

--- Comment #9 from Christoph Cullmann  ---
Ok, at fine that at least a part works now.
For the other issue, I have no concrete idea at the moment.

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 405197] KTextEditor : patch/.diff file folding broken (again)

2019-07-17 Thread RJVB
https://bugs.kde.org/show_bug.cgi?id=405197

--- Comment #8 from RJVB  ---
(In reply to Christoph Cullmann from comment #6)
> Hmm, the patch below isn't in 5.60, or? Have you tried master?

You mean a8013f3085ef2493e1109fd27ac4db608253636c? Indeed, it's just not in
5.60, somehow I mised that. It seems it addresses the main issues here.

The only naggle that remains is that if you fold a section and then delete it,
the carat for the next section becomes greyed-out, even if that section isn't
folded. It's as if this is the ghost carat from my previous comment which
displays on top of the carat of the next section. When that section is folded
too you need to click twice on the carat to unfold the section.

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 405197] KTextEditor : patch/.diff file folding broken (again)

2019-07-17 Thread RJVB
https://bugs.kde.org/show_bug.cgi?id=405197

--- Comment #7 from RJVB  ---
BTW, there's some weird behaviour if you

1 fold a patchfile hunk (or C/C++ block
2 select the line with the fold carat but not the line below
3 delete the line

The folded carat remains visible (also if you hit undo and restore the deleted
content!) and there be dragons if you click on it, no matter if that's before
or after restoring the deleted content. You cannot seem to get rid of that
ghost carat without reloading the document, and clicking it makes another
section fold.

This ghost carat also remains if you select and delete an entire folded section
(= 2 lines on the screen), and is just about as pesky in its behaviour and to
get rid of.

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 405197] KTextEditor : patch/.diff file folding broken (again)

2019-07-17 Thread Christoph Cullmann
https://bugs.kde.org/show_bug.cgi?id=405197

--- Comment #6 from Christoph Cullmann  ---
Hmm, the patch below isn't in 5.60, or? Have you tried master?

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 405197] KTextEditor : patch/.diff file folding broken (again)

2019-07-17 Thread RJVB
https://bugs.kde.org/show_bug.cgi?id=405197

RJVB  changed:

   What|Removed |Added

  Alias|:, breaks,  |
   |c004f3f787b2b6fd8a1c82a6641 |
   |0f5cb39febf18, file,|
   |folding, KTextEditor,   |
   |patch/.diff |

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 405197] KTextEditor : patch/.diff file folding broken (again)

2019-07-17 Thread RJVB
https://bugs.kde.org/show_bug.cgi?id=405197

RJVB  changed:

   What|Removed |Added

  Alias||KTextEditor, :,
   ||c004f3f787b2b6fd8a1c82a6641
   ||0f5cb39febf18, breaks,
   ||patch/.diff, file, folding

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 405197] KTextEditor : patch/.diff file folding broken (again)

2019-07-17 Thread RJVB
https://bugs.kde.org/show_bug.cgi?id=405197

RJVB  changed:

   What|Removed |Added

 Resolution|FIXED   |---
 Ever confirmed|0   |1
 Status|RESOLVED|REOPENED

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 405197] KTextEditor : patch/.diff file folding broken (again)

2019-07-17 Thread RJVB
https://bugs.kde.org/show_bug.cgi?id=405197

RJVB  changed:

   What|Removed |Added

Summary|KTextEditor :   |KTextEditor : patch/.diff
   |c004f3f787b2b6fd8a1c82a6641 |file folding broken (again)
   |0f5cb39febf18 breaks|
   |patch/.diff file folding|

-- 
You are receiving this mail because:
You are watching all bug changes.