Ticket #1486 (closed defect: fixed)

Opened 7 years ago

Last modified 6 years ago

Editor completion is confusing

Reported by: dborca Owned by: slavazanko
Priority: major Milestone: 4.7.0-pre3
Component: mcedit Version: 4.7.0-pre1
Keywords: Cc: dborca@…
Blocked By: Blocking:
Branch state: Votes for changeset: committed-master

Description

Editor completion became really confusing in 4.7.0-pre1:

  1. The list is populated with words from the entire file. This is arguably better than the old style, which scanned only up to the cursor. But the number of suggestions are limited, and if you have a bigger file, some words won't make it in the list. Besides, I somehow liked the old way.
  1. Suggestions do not end on a word boundary. This may or may be not useful; but it just increases the list of suggestions, which slows the user. In the end, it beats the purpose of completions.
  1. It completes the word I am currently editing. That's smart. :)
  1. The suggestions are displayed in the order in which they were found from the beginning of the file. This is my main gripe, because when using the editor for coding, it is better to have suggestions based on the distance to the cursor. Closer means higher. When writing a function, I am mainly interested in the variable names I recently used.
  1. Sometimes, it does not work at all, but I haven't investigated the bug. :(

I have attached the patch (against 4.7.0-pre1) which mimics the old behavior, but with the new search engine and minimal changes.

Attachments

mc-4.7.0-pre1.completion.patch.gz (1.1 KB) - added by dborca 7 years ago.
mc-4.7.0-pre1.completion.patch (2.3 KB) - added by angel_il 7 years ago.
mc-4.7.0-pre1.completion.2.patch (2.7 KB) - added by dborca 7 years ago.
Make sure we always get the closest match

Change History

Changed 7 years ago by dborca

comment:1 Changed 7 years ago by dborca

  • Cc dborca@… added

Changed 7 years ago by angel_il

comment:2 Changed 7 years ago by dborca

Regarding this in my original comment:

  1. Sometimes, it does not work at all, but I haven't investigated the bug. :(

static struct DLG_NODE *mc_manager = NULL;

will not complete "mc" to "mc_manager" because it expects (|
s) as left word boundary.

Changed 7 years ago by dborca

Make sure we always get the closest match

comment:3 Changed 7 years ago by slavazanko

  • Status changed from new to accepted
  • Owner set to slavazanko

comment:4 Changed 7 years ago by slavazanko

  • severity changed from no branch to on rework
-    match_expr = g_strdup_printf ("(^|\\s)%.*s[^\\s\\.=\\+\\{\\}\\[\\]\\(\\)\\\\\\!\\,<>\\?\\/@#\\$%%\\^&\\*\\~\\|\\\"'\\:\\;]+", word_len, bufpos);
+    match_expr = g_strdup_printf ("\\b%.*s[a-zA-Z_0-9]+", word_len, bufpos);

Hm... I'm added wild regexp for international words autocompletion( such as Russain, Greek etc).

Do you have any idea how write correct regexp to do this?

I like to autocomplete all words, not just English-only.

Created branch 1486_editor_completion (parent: master)

State is 'on rework'.

See:

comment:5 Changed 7 years ago by slavazanko

  • Milestone changed from 4.7.0-pre2 to 4.7.0-pre3

comment:6 Changed 7 years ago by slavazanko

  • severity changed from on rework to on review

Well. state 'on review'

initial commit:
8c6b664b4c44e52d3ff46b57c8c7d54e84342ad9

Full changes list:

git diff 8c6b664b4c44e52d3^..54bfb297b42ac53e9d

review, please.

comment:7 Changed 7 years ago by slavazanko

Fix codepage of autocompletion list:
changeset:7c834b95f15835853f8a65a726b6003a7e527784

Fix count of searched elements for autocompletion list. Also fixed codepage of inserted
into editor text:
changeset:1903ec8ce5e61f246ea97ea5197d50805c2f53ae

Added description of editor_wordcompletion_collect_entire_file option into man-file:
changeset:2cdb5450a1a0913ae5f3f6b8046558713e1053f1

review again, please.

comment:8 Changed 7 years ago by slavazanko

Added description of editor_wordcompletion_collect_entire_file option into mcedit.1 man-file:
changeset:db6a6f3f7308e54fd17bc3c958e8abd73fd75892

comment:9 Changed 7 years ago by andrew_b

  • Votes for changeset set to andrew_b

comment:10 Changed 7 years ago by angel_il

  • Votes for changeset changed from andrew_b to andrew_b angel_il
  • severity changed from on review to approved

comment:11 Changed 7 years ago by slavazanko

  • Status changed from accepted to testing
  • Votes for changeset changed from andrew_b angel_il to commited-master
  • Resolution set to fixed
  • severity changed from approved to merged

comment:12 Changed 7 years ago by slavazanko

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.