bugGNU TeXmacs - Bugs: bug #35786, when a section tag is applied to a...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #35786: when a section tag is applied to a selection containing a line feed, the selected text is lost

Submitted by:  Philippe Joyez <pjoyez>
Submitted on:  Sat 10 Mar 2012 10:15:39 PM UTC  
 
Category: EditorPriority: 5 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Joris van der Hoeven <vdhoeven>
Originator Name: philippe joyezOpen/Closed: Closed
Release: Release: None
Fixed Release: NoneFixed Release: 
Keywords: 

(Jump to the original submission Jump to the original submission)

Mon 13 Mar 2017 09:39:31 PM UTC, comment #7:

fixed by rev.10632:
If the selection ends by one or more empty new line, they are trimmed. Then, if the selection is still multi-paragraph: issue an error message and do nothing, otherwise make section tag. Also restores cursor position when possible.

Philippe Joyez <pjoyez>
Project Member
Mon 12 Mar 2012 10:03:53 PM UTC, comment #6:

What's Joris' opinion on this?

Miguel de Benito <mdbenito>
Project Member
Mon 12 Mar 2012 07:36:38 AM UTC, comment #5:

Just confirming that I had understood Philippe's bug and that reports below refer to that. The selection behavior options refer to the question by Miguel.

Alvaro Tejero Cantero <alv>
Project Member
Sun 11 Mar 2012 10:02:32 PM UTC, comment #4:

Sorry for the unclear report. I'll try to be more specific using Alvaro's notation.

So if the selection is

>first line<

second line

then inserting a section works as expected

On the other hand if the selection is

>first line

<second line

then inserting a section (or subsection, etc) you loose "first line"

Now consider inserting e.g. a "Theorem" instead of a "section", both selection patterns give the same (correct) result and do not loose any text, of course.

My point was not at all questioning what should be the behaviour on complicated selections spanning several paragraphs, it is a much more simple problem.

Philippe Joyez <pjoyez>
Project Member
Sun 11 Mar 2012 02:07:58 PM UTC, comment #3:

===reproducibility of the bug===
I am intrigued because I can reproduce the bug only if I use the vanilla .TeXmacs. On the other hand I don't have customizations for kbd-map of sections, and using both vanilla and custom .TeXmacs the key events are the same (as reported by the keyboard debugging tool) and creation of sections works normally.

===opinion on desirable behavior===
You probably can anticipate my strong viewpoint on this: the user is trying to give you some information with the selection, and you should use it in a well-defined way that she can rely upon after a few trial-and-error.

I think here the most useful is to realize that several paragraphs conform to the list protocol, hence: make one sectional heading out of each of them.

This is the efficient way to turn a collection of lines into headings. With > meaning selection start and < selection end:

becomes 3 headings

The question remains what to do in the more general case,

or even

In the TeXmacs representation paragraphs seem to be just implicated by an empty line.

I suggest to create a scheme function called "head-homogeneous?" that tests if in the selected collection all elements (in this case paragraphs) have the same head. For insance, if you select several items in an itemize a what-head? primitive should pick up what comes after the concat, because each item is

if all that is selected are items, they can be turned into sections. If there's something else, then ignore. The same goes for paragraphs, although the what-head? test should be special-cased for them because they (seem to) have this funky representation in terms of newlines.

Please correct if I overlooked something of the way the TeXmacs format works.

Alvaro Tejero Cantero <alv>
Project Member
Sun 11 Mar 2012 01:17:10 PM UTC, comment #2:

The problem is there, although I also cannot wholly reproduce what Philippe says:

  • selecting several paragraphs and creating a section out of them erases the text, but
  • selecting just one line does not.

(Unless you select all of it and an "empty" character from the next, what requires an extra "effort" explicitly telling TM to extend the selection and then you have a visual indication that you are going beyond the paragraph's boundaries)

But I think the report is essentially valid. Either:

  • the section should not be created or
  • the first paragraph should be taken, or
  • all should be merged into one prior to the creation of the section title or
  • anything but deleting the text.

I think the most reasonable is the first one. Opinions?

Miguel de Benito <mdbenito>
Project Member
Sat 10 Mar 2012 11:05:35 PM UTC, comment #1:

Could not confirm behaviour in QTeXmacs 1.0.7.14:4862.

Opened new document.

Typed paragraphs, some spanning several lines, some just one line.

Inserting sections across paragraph boundaries produced variable behavior in terms of inserted whitespace depending on the actual sectional tag (I tried Alt-1 Alt-2, Alt-3 in generic style), but no loss of existing text.

Maybe you can attach a minimal document showing the offending behaviour?

Alvaro Tejero Cantero <alv>
Project Member
Sat 10 Mar 2012 10:15:39 PM UTC, original submission:

It's more or less all in the title:
If you select a piece of text that contains an end of paragraph (newline or lf or cr, I don't know which is relevant), then the selected text is lost when you apply a section tag (or any other tag in the same group, subsection etc.)

This is especially annoying for example if you import a non-formatted text and want to tag some lines as sections headers. You must then be very careful NOT to select the whole line by typing Shift-down-arrow for instance. You must use rather Shift-end in order not to select the lf character.

Hope this was not filed previously.

Philippe Joyez <pjoyez>
Project Member

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mdbenito (Posted a comment)
  • -unavailable- added by alv (Posted a comment)
  • -unavailable- added by pjoyez (Submitted the item)
  •  

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 13 Mar 2017 09:39:31 PM UTCpjoyezStatusNeed Info=>Fixed
      Open/ClosedAccepted=>Closed
    Mon 12 Mar 2012 10:03:53 PM UTCmdbenitoAssigned toNone=>vdhoeven
    Sun 11 Mar 2012 01:17:10 PM UTCmdbenitoStatusNone=>Need Info
      Open/ClosedOpen=>Accepted

    Back to the top


    Powered by Savane 3.1-cleanup1