Update KJots to use KTextEdit #88

Merged
mio merged 1 commits from feat/kjots-use-ktextedit into master 4 weeks ago
mio commented 3 months ago
Collaborator

KEdit is deprecated and KTextEdit is one of the replacements. KTextEdit doesn't provide the find & replace functionality, so we have to re-implement that in KJotsEdit.

`KEdit` is deprecated and `KTextEdit` is one of the replacements. `KTextEdit` doesn't provide the find & replace functionality, so we have to re-implement that in `KJotsEdit`.
mio added 1 commit 3 months ago
c123c504c7
Update KJots to use KTextEdit
Owner

I assume you meant KEdit is deprecated.
Regarding the missing functionality, are you going to do more work for it or is this the final version of the PR?

I assume you meant `KEdit` is deprecated. Regarding the missing functionality, are you going to do more work for it or is this the final version of the PR?
mio commented 3 months ago
Poster
Collaborator

My mistake, I did mean KEdit (I'll update the commit later). And yes, I'll be updating the PR to add the missing functionality.

My mistake, I did mean KEdit (I'll update the commit later). And yes, I'll be updating the PR to add the missing functionality.
mio force-pushed feat/kjots-use-ktextedit from c123c504c7 to cff47abe19 3 months ago
mio commented 3 months ago
Poster
Collaborator

Update: The search and repeatSearch are almost working, there is a small issue with repeatSearch where the data isn't correctly reset when the current entry is changed. Should be an easy fix.

Still need to implement the replace function.

Update: The `search` and `repeatSearch` are almost working, there is a small issue with `repeatSearch` where the data isn't correctly reset when the current entry is changed. Should be an easy fix. Still need to implement the `replace` function.
mio force-pushed feat/kjots-use-ktextedit from cff47abe19 to 162cbc5c1e 2 months ago
mio force-pushed feat/kjots-use-ktextedit from 162cbc5c1e to 4f4e4fba50 2 months ago
mio changed title from WIP: Update KJots to use KTextEdit to Update KJots to use KTextEdit 2 months ago
mio requested review from Core 2 months ago
mio requested review from Owners 2 months ago
Owner

I will have a look at this on Thursday.

I will have a look at this on Thursday.
MicheleC reviewed 2 months ago
: KTextEdit(parent, name)
, m_entry(nullptr)
, m_find(nullptr)
, m_findDialog(nullptr)
Owner

m_findDialog and m_replaceDialog don't seem to be deleted anywhere in the code. Should that be added in KJotsEdit::~KJotsEdit() as well?

`m_findDialog` and `m_replaceDialog` don't seem to be `delete`d anywhere in the code. Should that be added in `KJotsEdit::~KJotsEdit()` as well?
mio commented 2 months ago
Poster
Collaborator

I had thought it would be okay since they both have a parent set when constructed, but it's been updated anyway to be sure.

I had thought it would be okay since they both have a parent set when constructed, but it's been updated anyway to be sure.
Owner

Oh yeah, my bad! Once they get a parent, they will be destroyed when the parent also get destructed, because of the TQObject hierarchy. Deleting them explicitly is then wrong, it would cause a double-free error. Sorry for putting you on the wrong track. We need to revert to the original code.

Oh yeah, my bad! Once they get a parent, they will be destroyed when the parent also get destructed, because of the TQObject hierarchy. Deleting them explicitly is then wrong, it would cause a double-free error. Sorry for putting you on the wrong track. We need to revert to the original code.
mio commented 2 months ago
Poster
Collaborator

No worries :-)
I have reverted the code.

No worries :-) I have reverted the code.
mio marked this conversation as resolved
mio force-pushed feat/kjots-use-ktextedit from 4f4e4fba50 to 45d184c9df 2 months ago
mio force-pushed feat/kjots-use-ktextedit from 45d184c9df to b1a4e9bfe2 2 months ago
Owner

I did a test. The new "standard" find/replace dialogs are nice, compared to the smaller original ones. Most things seem to work fine, but I found a problem with regex search.
I tried something like ^.*search_text.*$ and the whole text was selected instead of a single line. I tried the same search in Kate, on the same text and only a single like was selected instead. Do you see the same issue?

I did a test. The new "standard" find/replace dialogs are nice, compared to the smaller original ones. Most things seem to work fine, but I found a problem with regex search. I tried something like `^.*search_text.*$` and the whole text was selected instead of a single line. I tried the same search in Kate, on the same text and only a single like was selected instead. Do you see the same issue?
Owner

Another little issue: search for a word (even without regex). Continue the search till the end of the document. Press F3 again and KJots will ask to start searching from the beginning of the document again. Say yes, but notice how nothing is searched. It is necessary to press F3 again to actually get a search from the beginning of the document.
This does not happen in the original KJots, not it happens in Kate. In both cases after confirming the "search from the beginning of the document", the first match get found and selected.

Another little issue: search for a word (even without regex). Continue the search till the end of the document. Press `F3` again and KJots will ask to start searching from the beginning of the document again. Say yes, but notice how nothing is searched. It is necessary to press `F3` again to actually get a search from the beginning of the document. This does not happen in the original KJots, not it happens in Kate. In both cases after confirming the "search from the beginning of the document", the first match get found and selected.
mio commented 2 months ago
Poster
Collaborator

I tried something like ^.*search_text.*$ and the whole text was selected instead of a single line. I tried the same search in Kate, on the same text and only a single like was selected instead. Do you see the same issue?

Yep, happens for me as well. I'll take a look at this. It could be an issue with how the highlighting is performed, or the conversion between index and paragraph/index. (TQTextEdit uses paragraph/index-from-paragraph-start while KFind and KReplace use index-from-text-start.)

It seems that Kate doesn't use the KFind and KReplace classes that I opted for here, instead opting for a custom implementation. So it could be an issue with those classes, although this is unlikely.

Another little issue: search for a word (even without regex). Continue the search till the end of the document. Press F3 again and KJots will ask to start searching from the beginning of the document again. Say yes, but notice how nothing is searched. It is necessary to press F3 again to actually get a search from the beginning of the document.

Good point! I agree that it should automatically start the search again.

> I tried something like `^.*search_text.*$` and the whole text was selected instead of a single line. I tried the same search in Kate, on the same text and only a single like was selected instead. Do you see the same issue? Yep, happens for me as well. I'll take a look at this. It could be an issue with how the highlighting is performed, or the conversion between index and paragraph/index. (`TQTextEdit` uses paragraph/index-from-paragraph-start while `KFind` and `KReplace` use index-from-text-start.) It seems that Kate doesn't use the `KFind` and `KReplace` classes that I opted for here, instead opting for a custom implementation. So it *could* be an issue with those classes, although this is unlikely. > Another little issue: search for a word (even without regex). Continue the search till the end of the document. Press `F3` again and KJots will ask to start searching from the beginning of the document again. Say yes, but notice how nothing is searched. It is necessary to press `F3` again to actually get a search from the beginning of the document. Good point! I agree that it should automatically start the search again.
mio commented 2 months ago
Poster
Collaborator

I tried something like ^.*search_text.*$ and the whole text was selected instead of a single line.

After looking into it a bit more, this seems to be a limitation of TQRegExp which doesn't support multi-line matching.

We need ^ (caret) which when it is the first character in the regexp means that the regexp must match from the beginning of the string. And we also need $ (dollar) which when it is the last character in the regexp means that the regexp must match until the end of the string.

[...]

TQRegExp does not have an equivalent to Perl's /m option, but this can be emulated in various ways for example by splitting the input into lines or by looping with a regexp that searches for newlines.

[TQRegExp Documentation]

Not sure I have the right understanding of "looping with a regexp that searches for newlines", but I'll take a look at splitting the text into lines if the regex option is selected.

As an aside: I wonder if adding an option to change the behaviour of ^ and $ should be added to TQRegExp? I think most people nowadays would expect they match the start/end of a line, not the entire string.

> I tried something like `^.*search_text.*$` and the whole text was selected instead of a single line. After looking into it a bit more, this seems to be a limitation of TQRegExp which doesn't support multi-line matching. > We need `^` (caret) which when it is the first character in the regexp means that the regexp must match from the beginning of the string. And we also need `$` (dollar) which when it is the last character in the regexp means that the regexp must match until the end of the string. > > [...] > > TQRegExp does not have an equivalent to Perl's `/m` option, but this can be emulated in various ways for example by splitting the input into lines or by looping with a regexp that searches for newlines. > > [[TQRegExp Documentation][0]] Not sure I have the right understanding of *"looping with a regexp that searches for newlines"*, but I'll take a look at splitting the text into lines if the regex option is selected. As an aside: I wonder if adding an option to change the behaviour of `^` and `$` should be added to TQRegExp? I think most people nowadays would expect they match the start/end of a line, not the entire string. [0]: https://www.trinitydesktop.org/docs/qt3/tqregexp.html#1
mio force-pushed feat/kjots-use-ktextedit from b1a4e9bfe2 to 048b0fad79 2 months ago
mio commented 2 months ago
Poster
Collaborator

Made some changes so find/replace now operates on paragraphs, rather than the whole text. This allows the regex ^.*some_text.*$ to work as expected. I've also fixed clicking "Continue" from the final "Find Next" dialog so it will perform a search automatically.

Made some changes so find/replace now operates on paragraphs, rather than the whole text. This allows the regex `^.*some_text.*$` to work as expected. I've also fixed clicking "Continue" from the final "Find Next" dialog so it will perform a search automatically.
Owner

Made some changes so find/replace now operates on paragraphs, rather than the whole text. This allows the regex ^.some_text.$ to work as expected. I've also fixed clicking "Continue" from the final "Find Next" dialog so it will perform a search automatically.

Great, will do a new test and feedback, probably tomorrow.

I wonder if adding an option to change the behaviour of ^ and $ should be added to TQRegExp? I think most people nowadays would expect they match the start/end of a line, not the entire string.

If I understand correctly from your comments, the issue may not be in TQRegExp but the fact that KJots search treats the whole book as a single string? Haven't looked into the code, nor into how you fixed that, so I am jsut asking out of curiosity.

> Made some changes so find/replace now operates on paragraphs, rather than the whole text. This allows the regex ^.*some_text.*$ to work as expected. I've also fixed clicking "Continue" from the final "Find Next" dialog so it will perform a search automatically. Great, will do a new test and feedback, probably tomorrow. > I wonder if adding an option to change the behaviour of ^ and $ should be added to TQRegExp? I think most people nowadays would expect they match the start/end of a line, not the entire string. If I understand correctly from your comments, the issue may not be in TQRegExp but the fact that KJots search treats the whole book as a single string? Haven't looked into the code, nor into how you fixed that, so I am jsut asking out of curiosity.
mio commented 2 months ago
Poster
Collaborator

Great, will do a new test and feedback, probably tomorrow.

No worries, take your time :-)

I wonder if adding an option to change the behaviour of ^ and $ should be added to TQRegExp? I think most people nowadays would expect they match the start/end of a line, not the entire string.

If I understand correctly from your comments, the issue may not be in TQRegExp but the fact that KJots search treats the whole book as a single string? Haven't looked into the code, nor into how you fixed that, so I am jsut asking out of curiosity.

Pretty much. KJots was passing the entire contents of the entry as a single string, which caused the issue you experienced with the regex, since ^ and $ in TQRegExp match the start and end of the string respectively. The solution was to iterate through each paragraph (which are separated by newlines) and pass them to TQRegExp.

My comment was whether TQRegExp should support a multi-line mode, since it's a common modifier in other regex engines. It's not important for this PR, just a thought.

> Great, will do a new test and feedback, probably tomorrow. No worries, take your time :-) > > > I wonder if adding an option to change the behaviour of ^ and $ should be added to TQRegExp? I think most people nowadays would expect they match the start/end of a line, not the entire string. > > If I understand correctly from your comments, the issue may not be in TQRegExp but the fact that KJots search treats the whole book as a single string? Haven't looked into the code, nor into how you fixed that, so I am jsut asking out of curiosity. Pretty much. KJots was passing the entire contents of the entry as a single string, which caused the issue you experienced with the regex, since `^` and `$` in TQRegExp match the start and end of the string respectively. The solution was to iterate through each paragraph (which are separated by newlines) and pass them to TQRegExp. My comment was whether TQRegExp should support a multi-line mode, since it's a common modifier in other regex engines. It's not important for this PR, just a thought.
Owner

My comment was whether TQRegExp should support a multi-line mode, since it's a common modifier in other regex engines. It's not important for this PR, just a thought.

That could indeed be handy. We can also look at Qt4/5/6 and see if something like that has already been implemented. It may be as easy as a backport of some code.

> My comment was whether TQRegExp should support a multi-line mode, since it's a common modifier in other regex engines. It's not important for this PR, just a thought. That could indeed be handy. We can also look at Qt4/5/6 and see if something like that has already been implemented. It may be as easy as a backport of some code.
Owner

I did a new test. The regex issue with ^ and $ and the issue with search from begin/end of file are now fixed. Well done.
A couple of more points I picked up during testing and that we can improve:

  1. pressing F3 search again in the selected direction. I think users expect Shift+F3 to search in the opposite direction, like it does in Kate. In KJots Shift+F3 does not do anything
  2. if the search text is not found, Kate will open a dialog saying "text not found" and stop searching. KJots asks to search from the beginning of the file and will continue to prompt the user till he presses "stop"
  3. select some text before opening the search dialog. In Kate the "selected text" checkbox is enabled and the search only happens in the selected text if the checkbox is checked. In KJots the checkbox is grayed out and search is always happening on the complete text.

The first two points are probably easy fixes, the third one may need a bit more time. Once all are fixed, I think the functionality will be pretty good and we can look at a final review and merge, unless some other things pop up in the meanwhile.

Side note: I did not know this app, I was using KNotes or Kate to take simple notes. KJots fits in very nicely for that purpose :-)

I did a new test. The regex issue with ^ and $ and the issue with search from begin/end of file are now fixed. Well done. A couple of more points I picked up during testing and that we can improve: 1. pressing `F3` search again in the selected direction. I think users expect `Shift+F3` to search in the opposite direction, like it does in Kate. In KJots `Shift+F3` does not do anything 2. if the search text is not found, Kate will open a dialog saying "text not found" and stop searching. KJots asks to search from the beginning of the file and will continue to prompt the user till he presses "stop" 3. select some text before opening the search dialog. In Kate the "selected text" checkbox is enabled and the search only happens in the selected text if the checkbox is checked. In KJots the checkbox is grayed out and search is always happening on the complete text. The first two points are probably easy fixes, the third one may need a bit more time. Once all are fixed, I think the functionality will be pretty good and we can look at a final review and merge, unless some other things pop up in the meanwhile. Side note: I did not know this app, I was using KNotes or Kate to take simple notes. KJots fits in very nicely for that purpose :-)
mio force-pushed feat/kjots-use-ktextedit from 048b0fad79 to 695097feae 2 months ago
mio changed title from Update KJots to use KTextEdit to WIP: Update KJots to use KTextEdit 2 months ago
mio force-pushed feat/kjots-use-ktextedit from 695097feae to 816b354fab 2 months ago
mio commented 2 months ago
Poster
Collaborator
  1. pressing F3 search again in the selected direction. I think users expect Shift+F3 to search in the opposite direction, like it does in Kate. In KJots Shift+F3 does not do anything

This wasn't originally in KJots, but I've added it in the most recent push since it does make sense to support both forward and backwards searching.

There was an issue with the final count shown (when you reach the end of the document) as it counts the number of times the highlight() signal is emitted. Meaning if you swapped between searching forwards and backwards, you would likely end up with an incorrect number of matches.

This was "fixed" by not including the count in the final dialog, which I think works just as well. Just wanted to point this out in case you notice.

  1. if the search text is not found, Kate will open a dialog saying "text not found" and stop searhcing. KJots asks to search from the beginning of the file and will continue to prompt the user till he presses "stop"
  2. select some text before opening the search dialog. In Kate the "selected text" checkbox is enabled and the search only happens in the selected text if the checkbox is checked. In KJots the checkbox is grayed out and search is always happening on the complete text.

The first two points are probably easy fixes, the third one may need a bit more time.

I'll take a look at implementing these over the next couple of days. As you say, it's probably the last one that might take some extra time.

Side note: I did not know this app, I was using KNotes or Kate to take simple notes. KJots fits in very nicely for that purpose :-)

It is nice! I find it much easier to organize my notes, which were previously written on various little note pads laying around. (Especially since I never left enough blank pages between topics for when I revisited them 😅)

> 1. pressing `F3` search again in the selected direction. I think users expect `Shift+F3` to search in the opposite direction, like it does in Kate. In KJots `Shift+F3` does not do anything This wasn't originally in KJots, but I've added it in the most recent push since it does make sense to support both forward and backwards searching. There was an issue with the final count shown (when you reach the end of the document) as it counts the number of times the `highlight()` signal is emitted. Meaning if you swapped between searching forwards and backwards, you would likely end up with an incorrect number of matches. This was "fixed" by not including the count in the final dialog, which I think works just as well. Just wanted to point this out in case you notice. > 2. if the search text is not found, Kate will open a dialog saying "text not found" and stop searhcing. KJots asks to search from the beginning of the file and will continue to prompt the user till he presses "stop" > 3. select some text before opening the search dialog. In Kate the "selected text" checkbox is enabled and the search only happens in the selected text if the checkbox is checked. In KJots the checkbox is grayed out and search is always happening on the complete text. > > The first two points are probably easy fixes, the third one may need a bit more time. I'll take a look at implementing these over the next couple of days. As you say, it's probably the last one that might take some extra time. > > Side note: I did not know this app, I was using KNotes or Kate to take simple notes. KJots fits in very nicely for that purpose :-) It is nice! I find it much easier to organize my notes, which were previously written on various little note pads laying around. (Especially since I never left enough blank pages between topics for when I revisited them 😅)
Owner

It is nice! I find it much easier to organize my notes, which were previously written on various little note pads laying around. (Especially since I never left enough blank pages between topics for when I revisited them 😅)

Same here, I pretty much started using it immediately and replaced all my KNotes that were flying around on my desktop ;-)

Ping me here when you are done with those remaining points, I will do a further test then.

> It is nice! I find it much easier to organize my notes, which were previously written on various little note pads laying around. (Especially since I never left enough blank pages between topics for when I revisited them 😅) Same here, I pretty much started using it immediately and replaced all my KNotes that were flying around on my desktop ;-) Ping me here when you are done with those remaining points, I will do a further test then.
mio force-pushed feat/kjots-use-ktextedit from 816b354fab to e85ec2a502 2 months ago
mio force-pushed feat/kjots-use-ktextedit from e85ec2a502 to a04dccc7fc 2 months ago
mio force-pushed feat/kjots-use-ktextedit from a04dccc7fc to 6390e70e98 2 months ago
mio changed title from WIP: Update KJots to use KTextEdit to Update KJots to use KTextEdit 2 months ago
mio commented 2 months ago
Poster
Collaborator

Okay @MicheleC, should be good for another look now ( when you get a chance :-) )

Okay @MicheleC, should be good for another look now ( when you get a chance :-) )
Owner

Thanks @mio, I was actually wondering last night where we were up to with this one.
I have done a new test and here is the next round of feedback, with reference to the 3 items I highlighted here:

  1. item 1 is working fine, well done
  2. item 2 is working fine. I noticed a small difference between Kate and KJots. If a text is not found, both displays a messagebox. Pressing F3 again in Kate will try to search again for the same not found text. Pressing F3 in KJots brings up the search dialog instead. I would say Kate's behavior is consistent regardless of whether the string is found or not, while KJots behaves slightliy different in the two scenarios. It is not a big thing, what is your opinion about it?
  3. search in selection works fine but there are a couple of minor changes required.
  • if some text is selected and we press Ctrl+F, the Selected text checkbox should be checked by default when the search dialog opens (see Kate's behavior)
  • when reaching the end of the selection, Kate says End of selection reached while KJots says End of document reached which is a bit misleading

Item 3's points should be fixed.
Item 2's point is debatable, so I am interested in your opinion on that. IMO we should fix it too, but I don't want to force it :-)

Thanks @mio, I was actually wondering last night where we were up to with this one. I have done a new test and here is the next round of feedback, with reference to the 3 items I highlighted [here](https://mirror.git.trinitydesktop.org/gitea/TDE/tdeutils/pulls/88#issuecomment-60484): 1. item 1 is working fine, well done 2. item 2 is working fine. I noticed a small difference between Kate and KJots. If a text is not found, both displays a messagebox. Pressing `F3` again in Kate will try to search again for the same not found text. Pressing `F3` in KJots brings up the search dialog instead. I would say Kate's behavior is consistent regardless of whether the string is found or not, while KJots behaves slightliy different in the two scenarios. It is not a big thing, what is your opinion about it? 3. search in selection works fine but there are a couple of minor changes required. - if some text is selected and we press `Ctrl+F`, the `Selected text` checkbox should be checked by default when the search dialog opens (see Kate's behavior) - when reaching the end of the selection, Kate says `End of selection reached` while KJots says `End of document reached` which is a bit misleading Item 3's points should be fixed. Item 2's point is debatable, so I am interested in your opinion on that. IMO we should fix it too, but I don't want to force it :-)
mio commented 1 month ago
Poster
Collaborator
  1. item 2 is working fine. I noticed a small difference between Kate and KJots. If a text is not found, both displays a messagebox. Pressing F3 again in Kate will try to search again for the same not found text. Pressing F3 in KJots brings up the search dialog instead. I would say Kate's behavior is consistent regardless of whether the string is found or not, while KJots behaves slightliy different in the two scenarios. It is not a big thing, what is your opinion about it?

That does make sense, considering the action is called "Find Again", one might expect it to perform the search again even if nothing was found the last run. Will fix.

  1. search in selection works fine but there are a couple of minor changes required.
  • if some text is selected and we press Ctrl+F, the Selected text checkbox should be checked by default when the search dialog opens (see Kate's behavior)
  • when reaching the end of the selection, Kate says End of selection reached while KJots says End of document reached which is a bit misleading

I can implement the first point, no problem. The second one would probably be better addressed in the KFind class. (Kate uses its own dialog, whereas this patch uses the shouldRestart method provided by KFind.)

> 2. item 2 is working fine. I noticed a small difference between Kate and KJots. If a text is not found, both displays a messagebox. Pressing `F3` again in Kate will try to search again for the same not found text. Pressing `F3` in KJots brings up the search dialog instead. I would say Kate's behavior is consistent regardless of whether the string is found or not, while KJots behaves slightliy different in the two scenarios. It is not a big thing, what is your opinion about it? That does make sense, considering the action is called "Find Again", one might expect it to perform the search again even if nothing was found the last run. Will fix. > 3. search in selection works fine but there are a couple of minor changes required. > - if some text is selected and we press `Ctrl+F`, the `Selected text` checkbox should be checked by default when the search dialog opens (see Kate's behavior) > - when reaching the end of the selection, Kate says `End of selection reached` while KJots says `End of document reached` which is a bit misleading I can implement the first point, no problem. The second one would probably be better addressed in the KFind class. (Kate uses its own dialog, whereas this patch uses the `shouldRestart` method provided by KFind.)
Owner

That does make sense... Will fix.

Great, thanks!

I can implement the first point, no problem.

👍

The second one would probably be better addressed in the KFind class

Sounds good to me. This way we can probably also simplify the Kate code afterwards.

Let's fix the first two items and then merge this PR. Subsequently you can fix the last point in KFind as you suggested.

> That does make sense... Will fix. Great, thanks! > I can implement the first point, no problem. 👍 > The second one would probably be better addressed in the KFind class Sounds good to me. This way we can probably also simplify the Kate code afterwards. Let's fix the first two items and then merge this PR. Subsequently you can fix the last point in KFind as you suggested.
mio force-pushed feat/kjots-use-ktextedit from 6390e70e98 to 90fa625622 1 month ago
mio commented 1 month ago
Poster
Collaborator

Okay, should be good for another check now @MicheleC

Okay, should be good for another check now @MicheleC
Owner

I have done another tests and both item 1 and 2 are ok. Item 3 we will address on a separate PR.
I ran into one more bug during testing. Say you have the following text somewhere in kjots:

blah
first if second if third if forth if
first if second if third if forth if
first if second if third if forth if
blah

Select the three lines with ifs and search for if. Repeat a few searches and stop for example of the first if on the middle line. All works fine so far. Note that if is selected. Now press Ctrl+f to open the search dialog again and search for example for o: you would expect a failed search since the selection is now if, instead all the os in the middle line are found. Note the os on the other lines are correctly not found.
Try the same in Kate and you will see no os are found at all because the selection does not contain any o.
I think this is really the last bug, I ran into it by mistake actually 😰

I have done another tests and both item 1 and 2 are ok. Item 3 we will address on a separate PR. I ran into one more bug during testing. Say you have the following text somewhere in kjots: ``` blah first if second if third if forth if first if second if third if forth if first if second if third if forth if blah ``` Select the three lines with `if`s and search for `if`. Repeat a few searches and stop for example of the first `if` on the middle line. All works fine so far. Note that `if` is selected. Now press `Ctrl+f` to open the search dialog again and search for example for `o`: you would expect a failed search since the selection is now `if`, instead all the `o`s in the middle line are found. Note the `o`s on the other lines are correctly not found. Try the same in Kate and you will see no `o`s are found at all because the selection does not contain any `o`. I think this is really the last bug, I ran into it by mistake actually 😰
mio commented 1 month ago
Poster
Collaborator

I think this is really the last bug, I ran into it by mistake actually 😰

Nice! I'll take a look at fixing this today or tomorrow.

> I think this is really the last bug, I ran into it by mistake actually 😰 > Nice! I'll take a look at fixing this today or tomorrow.
mio force-pushed feat/kjots-use-ktextedit from 90fa625622 to 8bf76d50ef 1 month ago
mio commented 1 month ago
Poster
Collaborator

I ran into one more bug during testing [...]

The new changes should address this. Let me know what you think when you get a chance.

> I ran into one more bug during testing [...] The new changes should address this. Let me know what you think when you get a chance.
Owner

Just done a new test. The latest commit fixes the issue described before but introduce a new problem :-(

Select some text, search forward for something that exists in it a few times. When you reach the end of the selection, you get prompted to start again from the beginning, say yes and everything works fine.

Repeat but searching backward: this time after you get asked to start again from the end of the document, the text is not found. Please note this only happens when searching in a selection. If you do a backward search on the whole document, everything works just fine.

I know I am a bit picky in my testing, but I think it is important we commit good code after proper testing rather than rushing an incomplete/buggy solution. Please bear with me :-)

Just done a new test. The latest commit fixes the issue described before but introduce a new problem :-( Select some text, search **forward** for something that exists in it a few times. When you reach the end of the selection, you get prompted to start again from the beginning, say yes and everything works fine. Repeat but searching **backward**: this time after you get asked to start again from the end of the document, the text is not found. Please note this only happens when searching in a selection. If you do a backward search on the whole document, everything works just fine. I know I am a bit picky in my testing, but I think it is important we commit good code after proper testing rather than rushing an incomplete/buggy solution. Please bear with me :-)
mio force-pushed feat/kjots-use-ktextedit from 8bf76d50ef to 61af9b57bf 1 month ago
mio commented 1 month ago
Poster
Collaborator

Repeat but searching backward: this time after you get asked to start again from the end of the document, the text is not found. Please note this only happens when searching in a selection. If you do a backward search on the whole document, everything works just fine.

Hmm, I don't experience this. Are you searching with the "Find backwards" option checked or by pressing SHIFT+F3? (or both?)

I know I am a bit picky in my testing, but I think it is important we commit good code after proper testing rather than rushing an incomplete/buggy solution. Please bear with me :-)

Don't worry about it! I appreciate you taking the time to test it so thoroughly :-)

> Repeat but searching **backward**: this time after you get asked to start again from the end of the document, the text is not found. Please note this only happens when searching in a selection. If you do a backward search on the whole document, everything works just fine. Hmm, I don't experience this. Are you searching with the "Find backwards" option checked or by pressing SHIFT+F3? (or both?) > I know I am a bit picky in my testing, but I think it is important we commit good code after proper testing rather than rushing an incomplete/buggy solution. Please bear with me :-) Don't worry about it! I appreciate you taking the time to test it so thoroughly :-)
Owner

Hmm, I don't experience this. Are you searching with the "Find backwards" option checked or by pressing SHIFT+F3? (or both?)

I checked the "Find backbard" checkbox in the Find dialog and then use F3 for repeated searches. I haven't tried Shift+F3 in this case, I can build again and do another test if you want.

Don't worry about it! I appreciate you taking the time to test it so thoroughly :-)

Thanks 🤝

> Hmm, I don't experience this. Are you searching with the "Find backwards" option checked or by pressing SHIFT+F3? (or both?) I checked the "Find backbard" checkbox in the Find dialog and then use F3 for repeated searches. I haven't tried Shift+F3 in this case, I can build again and do another test if you want. > Don't worry about it! I appreciate you taking the time to test it so thoroughly :-) Thanks 🤝
mio force-pushed feat/kjots-use-ktextedit from 61af9b57bf to e1c413a8a9 1 month ago
mio commented 1 month ago
Poster
Collaborator

I checked the "Find backbard" checkbox in the Find dialog and then use F3 for repeated searches. I haven't tried Shift+F3 in this case, I can build again and do another test if you want.

If you don't mind. Even when trying with both methods, I still don't have the same issue.

The latest version fixed an issue with searching in selected text where starting/ending a selection halfway through a line wasn't working correctly. (It would continue to search outside of the selection).

Not sure if this will fix your issue as well.

> I checked the "Find backbard" checkbox in the Find dialog and then use F3 for repeated searches. I haven't tried Shift+F3 in this case, I can build again and do another test if you want. If you don't mind. Even when trying with both methods, I still don't have the same issue. The latest version fixed an issue with searching in selected text where starting/ending a selection halfway through a line wasn't working correctly. (It would continue to search outside of the selection). Not sure if this will fix your issue as well.
MicheleC approved these changes 1 month ago
MicheleC left a comment
Owner

The last commit seems to fix the last issue, so we can finally proceed and merge this PR. Great job and thanks for all the adjustments along the way @mio.

The last commit seems to fix the last issue, so we can finally proceed and merge this PR. Great job and thanks for all the adjustments along the way @mio.
MicheleC added this to the R14.1.4 release milestone 1 month ago
Owner

We can also backport to R14.1.x.

We can also backport to R14.1.x.
mio merged commit 7279656192 into master 4 weeks ago
mio deleted branch feat/kjots-use-ktextedit 4 weeks ago
mio commented 4 weeks ago
Poster
Collaborator

Thanks for reviewing @MicheleC!

Thanks for reviewing @MicheleC!

Reviewers

MicheleC approved these changes 1 month ago
TDE/Core was requested for review 2 months ago
The pull request has been merged as 7279656192.
Sign in to join this conversation.
No reviewers
TDE/Core
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: TDE/tdeutils#88
Loading…
There is no content yet.