bugGNU Octave - Bugs: bug #58418, Saving file scrolls editor's text...


bug #58418: Saving file scrolls editor's text area

Submitted by:  Daniel Molina García <dmolina>
Submitted on:  Wed 20 May 2020 09:26:22 PM UTC  
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sun 24 May 2020 10:10:41 AM UTC, comment #5: 

Hg200, thanks for testing. I have pushed both patches to default and added you to the list of contributors.

Closing this report as fixed.

Torsten Lilge <ttl>
Project Member
Sat 23 May 2020 08:50:45 PM UTC, comment #4: 

I appreciate your smaller variant. Looks better. And thank you for pointing out QScrollBar.

I tested both files (#49148 and #49149) on the current tip and from my side the issue is solved.

Hg200 <hg200>
Fri 22 May 2020 08:57:21 PM UTC, comment #3: 

Hg200, thanks for the patch, looks good. I do not if it is better (maybe a question of style or personal preference) but attached a shorter version without adding methods to octave_scintilla. What do you think?

The other issue you are mentioning in comment #2 should be fixed by the other patch, attached as second file. It has to be applied after the first one.

(file #49148, file #49149)

Torsten Lilge <ttl>
Project Member
Thu 21 May 2020 07:49:32 PM UTC, comment #2: 

intuitively i would fix the bug as it is done in the attached patch. since i am not a maintainer the patch should be reviewed carefully before check in. special question from my side is the implication to include QtWidgets. maybe we can do better?

by the way, i noticed another problem in the affected code section: line and column of the cursor are set after loading the trimmed file. however, the case is not catched if the cursor column no longer exists. this can happen by cutting off the white spaces at the line ends. in such a case the cursor jumps one or two lines forward when saving the file. this is odd. i only want to mention as this behaviour becomes now more apparent since the scrollbar is fixed. if this is unwanted somebody should open a new bug report.

(file #49143)

Hg200 <hg200>
Thu 21 May 2020 10:44:43 AM UTC, comment #1: 

Happens when "Remove trailing spaces when saving files" is activated and a larger file is opened and the cursor is placed somewhere in the middle and the changes are saved.

Built against different Qt versions and can see the behavior in both older and newer Qt versions.

I guess that simply m_edit_area-> setText (edit_text) in file-editor-tab.cc:2306 potentially changes the position of the vscrollbar when the trimmed data is put back to the m_edit_area.

Hg200 <hg200>
Wed 20 May 2020 09:26:22 PM UTC, original submission:  

If scrollbar's slider is on the top (where it is when a file is open), nothing wrong happens.

If scrollbar's slider is somewhere else, after saving the file the text area is scrolled in such a way that the line where cursor is is placed as the last visible line of the text area. In the case that cursor is in the last visible line, no effect is appreciated after saving.

Daniel Molina García <dmolina>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by ttl (Updated the item)
  • -email is unavailable- added by hg200 (Posted a comment)
  • -email is unavailable- added by dmolina (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-05-24 ttl StatusNone => Fixed
        Open/ClosedOpen => Closed
    2020-05-22 ttl Attached File- => Added patch_jumping_scrollbar_v2.diff, #49148
        Attached File- => Added update_col_removed_spaces_v1.patch, #49149
    2020-05-21 hg200 Attached File- => Added patch_jumping_scrollbar_v1.diff, #49143

    Back to the top

    Powered by Savane 3.5