bugGNU Octave - Bugs: bug #56533, Cursor misplaced when entering...

 
 

bug #56533: Cursor misplaced when entering newline in editor with tabs indentation

Submitter:  Markus Ebner <seijikun>
Submitted:  Fri 21 Jun 2019 12:12:10 PM UTC
   
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 12 Jul 2019 08:31:35 AM UTC, comment #16: 

I haven't found any more papercuts still affecting me yet. Thank you very much!

Markus Ebner <seijikun>
Mon 08 Jul 2019 07:45:55 PM UTC, comment #15: 

Sounds good. Now it is up to you: Are there some more issues left (the paper-cuts in comment #11) or can this report be closed?

Torsten Lilge <ttl>
Group Member
Mon 08 Jul 2019 09:10:50 AM UTC, comment #14: 

Been using it for a couple of hours now. Everything seems to be working fine. Thank you very much!

Markus Ebner <seijikun>
Thu 04 Jul 2019 07:33:28 PM UTC, comment #13: 

I have pushed changeset http://hg.savannah.gnu.org/hgweb/octave/rev/1ae91e5d70cc which should also fix the issue reported in comment #11.

Torsten Lilge <ttl>
Group Member
Thu 27 Jun 2019 07:12:04 PM UTC, comment #12: 

While fixing the original bug, I came across another issue with auto-close and auto-intend, which I am trying to fix right now. I will then also have a look at the wrong indentation width, no extra bug report required.

Torsten Lilge <ttl>
Group Member
Thu 27 Jun 2019 03:33:41 PM UTC, comment #11: 

The example below is fixed now, thanks!

There, however, still are a couple of paper-cuts when using tab indentation. An Example (using tab indentation):

classdef Test
        methods#< hit enter here
endclassdef


This results in the following:

classdef Test
        methods

  endmethods
endclassdef


The cursor is correctly positioned (line & indentation are correct), but the inserted closing-directive is misplaced.
Should this be raised in another bug report?

Markus Ebner <seijikun>
Tue 25 Jun 2019 08:43:16 PM UTC, comment #10: 

I have pushed changeset http://hg.savannah.gnu.org/hgweb/octave/rev/dffdabfd0213 which solves the issue for me.

Torsten Lilge <ttl>
Group Member
Sun 23 Jun 2019 07:36:18 PM UTC, comment #9: 

With Tab width 4, Indent 4 and "Indentation uses tabs" I can also confirm this on Windows 7 with dev Octave.

A workaround would be to use spaces rather than tabs (as is the GNU coding style) but I admit that is far-fetched if e.g. you want to adapt someone else's code if that use tabs for indentation (i.e., most Matlab code).

Philip Nienhuis <philipnienhuis>
Group Member
Fri 21 Jun 2019 07:23:57 PM UTC, comment #8: 

Yes I can confirm that there is a problem here with those settings.

Doug Stewart <dastew>
Fri 21 Jun 2019 06:50:35 PM UTC, comment #7: 

I think I just found the culprit. This does not happen with a default octave configuration.
However, when changing the following setting:

[Editor]
  Indentation
    - Indentation uses tabs

the problem starts to appear. It is already broken at this point, without changing anything further, but the width settings (Indent with & Tab width) further change the buggy behavior.
The behavior I reported can be witnessed when using a value of 4 for both width settings.

Markus Ebner <seijikun>
Fri 21 Jun 2019 05:16:15 PM UTC, comment #6: 

Works fine for me on Windows and Linux (Mageia-6) with Octave-5.0.1 and 6.0.0+. In fact I cannot remember to have ever seen something like you describe. I don't doubt your observations though.

Could it be due to language settings? what happens if you set Octave's language to US English, french or German?
Or maybe font size (do you use a non-monospaced font)?


Philip Nienhuis <philipnienhuis>
Group Member
Fri 21 Jun 2019 12:59:38 PM UTC, comment #5: 

System-Information:
 - openSUSE Tumbleweed
 - Linux 5.1.7-1-default
 - Octave 5.1.0
 - libqscintilla2_qt5 2.11.1-1.3

A complete build log of the octave I am using can be found here
All build-time dependencies (+ version numbers) can be found from [51s] onwards.

Markus Ebner <seijikun>
Fri 21 Jun 2019 12:42:42 PM UTC, comment #4: 

In the video, I placed the cursor at the right of the closing round bracket (in the first line) and pressed <Enter>.
But you're right, I unfortunately messed up the second part of the text-example by forgetting to insert a newline. There is no edit-button, so here is the correct version:

Start:

function thisIsATest()
        disp("test");
endfunction

Place cursor at end of first line, press <enter>.
Result:

function thisIsATest()

        disp("test");
         ^

Newline is inserted, but cursor lands one line below, between "d" and "i" of "display(...".

Markus Ebner <seijikun>
Fri 21 Jun 2019 12:41:30 PM UTC, comment #3: 

Ok i just saw your video!!!
This does not happen on my system.
Ubuntu 18.04
octave 5.1.1

Doug Stewart <dastew>
Fri 21 Jun 2019 12:36:34 PM UTC, comment #2: 

Your example is confusing. You say "put the cursor at the end of the first line" etc but show the results of when the cursor was put at the end of the second line.

Doug Stewart <dastew>
Fri 21 Jun 2019 12:14:40 PM UTC, comment #1: 

I attached a video demonstrating the bug.

Markus Ebner <seijikun>
Fri 21 Jun 2019 12:12:10 PM UTC, original submission:  

Hey guys.
When I use the editor and insert a newline between two code-lines, the cursor is not placed where it should be.
If I remember correctly, this bug has always been there, as long as I used octave (4.x). I am currently using 5.1.0 though.

Example; editing a new file with the content:

function thisIsATest()
        disp("test");
endfunction


Put the cursor at the end of the first line. When I now press Enter, to insert a new line, I would expect the cursor to land in this line, with the proper indendation as taken from the line below it. Instead, the cursor lands here (before the "i"):

function thisIsATest()
        disp("test");
         ^

This only happens when there are two code-lines directly beneath each other.
This makes inserting multiple newlines pretty cumbersome, as you might imagine.

Markus Ebner <seijikun>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #47115:  demo.mp4 added by seijikun (165KiB - video/mp4 - Demonstration video)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by philipnienhuis
  • -email is unavailable- added by dastew (Posted a comment)
  • -email is unavailable- added by seijikun (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-07-12 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
        Release5.1.0 dev
    2019-06-25 ttl StatusConfirmed Ready For Test
    2019-06-23 philipnienhuis Item GroupNone Incorrect Result
        StatusNeed Info Confirmed
        Operating SystemGNU/Linux Any
        SummaryCursor misplaced when entering newline in editor Cursor misplaced when entering newline in editor with tabs indentation
        Carbon-Copy- Added ttl
    2019-06-21 philipnienhuis StatusNone Need Info
    2019-06-21 seijikun Attached File- Added demo.mp4, #47115

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code