Alexey-T / CudaText

Cross-platform text editor, written in Free Pascal
Mozilla Public License 2.0
2.5k stars 171 forks source link

"Top line index" is not restored from session for passive tabs #3112

Closed JairoMartinezA closed 3 years ago

JairoMartinezA commented 3 years ago

Hi @Alexey-T Testing with two opened files and saving the session:

image

If my last caret position is in the far-left tab when I close CT, if I start again CT, CT shows me this first tab and scrolls the window to show me that last line (as the previous picture). But if my last edited line is the second tab, when I restart CT, in this case CT shows me indeed the second tab but not scrolls to this caret position (I need to use directions keys or start the typing):

image

My feature request :bowtie: is set CT to scroll to last caret in each file when I restart the editor.

Alexey-T commented 3 years ago

Thanks for report- looks like a bug with initial scroll pos lost.

Alexey-T commented 3 years ago

Fixed for 'word wrap off' in user.json Tofix! for 'word wrap on' (1).

Alexey-T commented 3 years ago

Made more fixing; will post beta tomorrow (GMT+3 morning)

Alexey-T commented 3 years ago

Beta updated; let's tets it. Not simple fix, need to test http://uvviewsoft.com/c/ test with "wrap_mode":0 and :1 (user.json). with several files in session with different 'index of top visible line'.

@tmsg-gh @kvichans

JairoMartinezA commented 3 years ago

Something is happening with my installed plugins, with the beta upgrade they are not working anymore. I am still with more validations.

Alexey-T commented 3 years ago

cudatext.py file must be updated! it may crash python code, if not.

JairoMartinezA commented 3 years ago

I am testing now with a fresh install and after that I proceeded to install Favorites plugin, is not working, the same with Cuda-Ext both of @kvichans 😱

Alexey-T commented 3 years ago

Yes; seems last Lazarus update is broken, confirmed

Alexey-T commented 3 years ago

Laz reverted to some old version, beta updated!

JairoMartinezA commented 3 years ago

Favorites plugin is working but CudaExt is not working:

image

This option no show anything.

Alexey-T commented 3 years ago

Posted to new issue.

Alexey-T commented 3 years ago

@Jairo-Martinez let's test this?

JairoMartinezA commented 3 years ago

Issue found:

  1. Open CT and open 3 files.
  2. Move files to different positions to test the functionality (Obviously you need to make click in the other tabs).
  3. Restart CT
  4. CT remembers and scroll to last position (Making a click on each opened tab)
  5. Restart CT
  6. Focus just in current tab and don't click in any another tab.
  7. Restart CT again.
  8. In this case CT is not scrolling to last position when you validate the other tabs.
Alexey-T commented 3 years ago

Good catch! beta fixed+updated.

JairoMartinezA commented 3 years ago

Let me test again, I found another issue painting lexer colors with Word-Wrap enabled but I will try to repro.

Alexey-T commented 3 years ago

(pls, to a new issue)

JairoMartinezA commented 3 years ago
  1. Open CT and open many files.
  2. In current tab move to some position.
  3. Restart CT remember the position but move around 6 lines above the scroll.
  4. Don't do anything and restart again CT.
  5. CT moves again the scroll another 6 lines and eventually the caret is lost (visually)
Alexey-T commented 3 years ago

do you mean that after restart, CT shows scroll position ONE line lower than needed? I saw that too, so confirm.

Alexey-T commented 3 years ago

@Jairo-Martinez If you reply 'yes' to above, let's find-- is it new issue (with that ONE line shift) or the old one? old Cud versions- how do they do? if it is old issue- I will delay the fix, after release.

note: this issue needs "wrap_mode":1

JairoMartinezA commented 3 years ago

Yes, it is related to "wrap_mode":1

I am repeating the test with a fresh install, let me a couple of minutes to found exactly the steps to repro.

Alexey-T commented 3 years ago

(let's post a new issue. the SUBJ is solved)

JairoMartinezA commented 3 years ago

Sure

JairoMartinezA commented 3 years ago

Question @Alexey-T, the functionality to move the scroll, it is using the last caret position or the last scroll position?

Alexey-T commented 3 years ago

caret position is not relative at all. caret can be at end-of-file.

JairoMartinezA commented 3 years ago

So?

Because currently If I put the cursor at line 50, but I scroll the windows to see the line 400, after restart CT, CT shows me this last scroll position, is not moving to line 50, but the caret remains in the line 50.

Alexey-T commented 3 years ago

CT saves 2 numbers to session: caret pos, top line index

JairoMartinezA commented 3 years ago

Answered.