Ticket #1447 (new enhancement)
Wrap long lines in editor
Reported by: | ache | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | Future Releases |
Component: | mcedit | Version: | 4.7.0-pre1 |
Keywords: | Cc: | mooffie@…, ales.janda@… | |
Blocked By: | Blocking: | ||
Branch state: | no branch | Votes for changeset: |
Description
It would be convenient if editor gets the ability to wrap lines when line length exceeds screen width.
Attachments
Change History
comment:3 Changed 13 years ago by andrew_b
- Branch state set to no branch
- Milestone changed from 4.7 to Future Releases
comment:5 Changed 2 years ago by andrew_b
Ticket #4336 has been marked as a duplicate of this ticket.
comment:7 Changed 13 months ago by andrew_b
Ticket #4492 has been marked as a duplicate of this ticket.
Changed 13 months ago by psprint
- Attachment 0001-Implementation-of-soft-wraps-screen-only-division-of.patch added
Add soft wraps to MCEdit
comment:8 Changed 13 months ago by psprint
Hi,
I've implemented screen-only division of long lines. I'll call it soft wraps.
I think that this feature is missing from mcedit. Currently, when a line exceeds the screen it is scrolled right. This is, IMHO, a less effective way of working with long lines. More natural is to have them soft-divided by the editor with moving, home/end keys support, etc.
The patch is little long and complex, but I'm using it from 2 years with no problems. To have the lines soft wrapped, select "Soft wraps" in the General options dialog.
Answering the comment in the previous (closed as duplicate) ticket: there are markings of the wrapped lines – if one enables line numbers: https://asciinema.org/a/KVP6dRocGtb2XGLO26sjL60sZ. Also I disagree that code shouldn't be folded at least to me, as I'm using the patch from 2 years to edit code. After turning the option on I've never looked back.
Changed 13 months ago by psprint
- Attachment 0001-Implementation-of-soft-wraps-screen-only-division-of.2.patch added
An update that restores the missing CK action allowing keybind toggling soft wraps (alt-w by default)
comment:9 Changed 13 months ago by psprint
I've restored the keybinding SoftFolds? that got lost in the merge (Alt-w by default). Demo: https://asciinema.org/a/o3N8nrNdt3Q1dBjHGt0yP6uP8
comment:10 Changed 13 months ago by andrew_b
Changed 13 months ago by psprint
- Attachment 0001-Implementation-of-soft-wraps-screen-only-division-of.3.patch added
Reformatted the patch to meet Hacking document. Other things like comparing NULL for pointers instead of if(ptr) already meet
comment:11 Changed 13 months ago by psprint
Andrew: I've submitted updated patch
comment:12 follow-up: ↓ 13 Changed 13 months ago by andrew_b
comment:13 in reply to: ↑ 12 ; follow-up: ↓ 14 Changed 13 months ago by psprint
Replying to andrew_b:
I've uploaded updated patch. I've removed int q=Q() from it. Are there any other things that are unaligned? I would ask for a direct references or at least names of the formatting/code errors.
Changed 13 months ago by psprint
- Attachment 0001-Implementation-of-soft-wraps-screen-only-division-of.4.patch added
An update that removes the inline declaration assignments like: int q=Q()
comment:14 in reply to: ↑ 13 Changed 13 months ago by andrew_b
Replying to psprint:
I've uploaded updated patch. I've removed int q=Q() from it. Are there any other things that are unaligned?
Is it all that you read in HACKING?
I would ask for a direct references or at least names of the formatting/code errors.
- Follow source templates
- Do not unnecessarily use braces where a single statement will do.
- Use your best judgement and choose the more readable option.
for (; (edit_buffer_get_byte_ex (buf, current_eol) != '\n') && current_eol <= buf->size && (current_eol == current_save || ((q = edit_move_forward3 (buf->edit_widget, current_bol, 0, current_eol, FALSE, 0) % buf->end_col) != 0)); current_eol = edit_move_forward3 (buf->edit_widget, current_eol, 1, 0, FALSE, 0), current_eol += prev_eol == current_eol ? 1 : 0, prev_eol = current_eol) ;
Save my eyes and my brain.
- Avoid initialized and not initialized variables in one declaration.
- Reduce variable scope as much as possible: declare local variable in that block where it is used.
- Split variable declaration and code using one empty line.
- Do not use gboolean as integer and integer as bgoolean.
And this is only the first step.
comment:15 Changed 13 months ago by psprint
Sorry, but I have to stop supporting this patch. Someone paid me for the soft wraps implementation, but now the financing stopped and I'm unable to meet your high level expectations.
Is you mean behaviour like VI(M)?