Skip to content

Select multiple words/lines when double/triple clicking. - #5127

Merged
mc-worker merged 3 commits into
MidnightCommander:masterfrom
RobertP-McDowell:master
Jul 19, 2026
Merged

Select multiple words/lines when double/triple clicking.#5127
mc-worker merged 3 commits into
MidnightCommander:masterfrom
RobertP-McDowell:master

Conversation

@RobertP-McDowell

@RobertP-McDowell RobertP-McDowell commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

Quality of life feature for mouse users. Many text editors have the ability to drag select words and lines, and mcedit already allows you to select one word at a time, this is just an improvement of what's already there!

Also updated how the delay between clicks works to start the timer on mouse down instead of up, this is a lot more common in text editors (your very browser probably behaves this way); this change affects all other widgets that use double-click functionality.

  • Resolves: #... (No prior issue I could find)

Checklist

  • I have referenced the issue(s) resolved by this PR (if any)
  • I have signed-off my contribution with git commit --amend -s
  • Lint and unit tests pass locally with my changes (make indent && make check)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)

Tested with both gpm and xterm-only mouse support, ncurses, and slang.

@github-actions github-actions Bot added needs triage Needs triage by maintainers prio: medium Has the potential to affect progress labels Jun 14, 2026
@github-actions github-actions Bot added this to the Future Releases milestone Jun 14, 2026

@ossilator ossilator left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the commit messages lack explanations/justifications of the changes.

also, judging by the commit message, the 2nd commit mixes two unrelated changes.

@RobertP-McDowell

RobertP-McDowell commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

I made each commit message clearer, and I thought changing the click time delay was an important enough change to warrant a third commit after all, so I split up the 2nd commit into two.

Comment thread src/editor/edit.c Outdated
Comment thread src/editor/edit.c Outdated
Comment thread src/editor/edit.c
Comment thread src/editor/edit.c Outdated
Comment thread src/editor/editwidget.c Outdated
Comment thread src/editor/edit-impl.h Outdated
Comment thread src/editor/edit-impl.h Outdated
Comment thread src/editor/edit.c
Comment thread src/editor/edit.c Outdated
Comment thread src/editor/edit.c Outdated
Comment thread src/editor/edit.c Outdated
Comment thread src/editor/edit.c Outdated
@RobertP-McDowell

Copy link
Copy Markdown
Contributor Author

I changed the functionality a bit so double clicking will always select at least one character in my last force-push, and resolved the reviewed changes. Thanks.

Comment thread src/editor/edit.c Outdated
@mc-worker

Copy link
Copy Markdown
Contributor

Thanks! Double click to select a word and a triple click to select a line work fine. But the descriptions of the 2nd commit is unclear for me.

Highlight multiple lines when triple clicking in mcedit.

Like the last commit, improves triple clicking to allow the user to drag select multiple lines on double clicking in the editor.

Could you please describe how it should work?

@RobertP-McDowell
RobertP-McDowell force-pushed the master branch 2 times, most recently from 9b2abd6 to 857c485 Compare June 27, 2026 07:31
@RobertP-McDowell

RobertP-McDowell commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

So what's the next step to get this feature merged? Is it a matter of whether or not it is wanted at this point? I've been using it since, and it works as expected. Also If/When I need to update my branch, should I avoid a merge commit?

@mc-worker mc-worker added area: mcedit mcedit, the built-in text editor and removed needs triage Needs triage by maintainers labels Jul 18, 2026
@mc-worker mc-worker modified the milestones: Future Releases, 4.9.0 Jul 18, 2026
@mc-worker

Copy link
Copy Markdown
Contributor

/rebase

@mc-worker

Copy link
Copy Markdown
Contributor

@RobertP-McDowell I rebased your branch but cannot merge it because some checks failed:

Indentation:

diff --git a/src/editor/edit.c b/src/editor/edit.c
index 87583d6..e423747 100644
--- a/src/editor/edit.c
+++ b/src/editor/edit.c
@@ -946,10 +946,10 @@ edit_get_current_word_extents (WEdit *edit, off_t *start, off_t *end)
 
         if (is_break_char (check_char))
         {
-            if (pos == edit->buffer.curs1) // always select at least one character.
+            if (pos == edit->buffer.curs1)  // always select at least one character.
             {
                 *start = pos;
-                *end = pos+1;
+                *end = pos + 1;
                 return;
             }
             break;

DCO:

Commit sha: a4416e6, Author: robert, Committer: Andrew Borodin; Expected "robert teatimewithrobert@gmail.com", but got "Robert P. McDowell teatimewithrobert@gmail.com".
Commit sha: fec3f74, Author: robert, Committer: Andrew Borodin; Expected "robert teatimewithrobert@gmail.com", but got "Robert P. McDowell teatimewithrobert@gmail.com".

This is an improvement to double clicking in the editor, allowing
the user to select multiple words by dragging the mouse. Previously,
the user could only select one word at a time by double clicking.

Signed-off-by: Robert P. McDowell <teatimewithrobert@gmail.com>
Improves triple clicking in the editor, allowing the user to select
multiple lines after a triple-click by dragging the mouse. Previously,
the user could only select one line at a time after triple clicking.

Signed-off-by: Robert P. McDowell <teatimewithrobert@gmail.com>
This is to compliment the last two commits. Before if the user
dragged their mouse and tried to immediately click, they might
unintentionally initiate a double click; after triple clicking was
re-implemented it was a noticabely bigger issue, with accidental
triple clicks. Fix it by starting the click timer on an earlier input.

Signed-off-by: Robert P. McDowell <teatimewithrobert@gmail.com>
@RobertP-McDowell

RobertP-McDowell commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! I had to push --force-with-lease to fix the DCO, you may have to do the same on the rebase branch, I'm not sure.

@mc-worker
mc-worker removed the request for review from ossilator July 19, 2026 09:35
@mc-worker
mc-worker merged commit 9927d07 into MidnightCommander:master Jul 19, 2026
24 checks passed
@mc-worker

Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: mcedit mcedit, the built-in text editor prio: medium Has the potential to affect progress

Development

Successfully merging this pull request may close these issues.

3 participants