Ticket #2979 (accepted enhancement)

Opened 7 years ago

Last modified 2 years ago

More user friendly bookmark management

Reported by: szaszg Owned by: slavazanko
Priority: major Milestone: Future Releases
Component: mcedit Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

It will be nice, if user can:

  • remove bookmarks individualy
  • show up a bookmark list to select and remove bookmarks (like directory hotlist in filemanager)

Attachments

book_mark_list.png (32.5 KB) - added by szaszg 7 years ago.
screenshot: bookmark list dialog
mc.2979.diff (29.4 KB) - added by szaszg 7 years ago.
a "filemanager:hotlist" like bookmark list dialog
bookmarks.patch (28.3 KB) - added by aurel 6 years ago.
Original patch updated for current version
1_bookmarks_2.patch (27.6 KB) - added by aurel 6 years ago.
1_bookmarks_2.2.patch (27.2 KB) - added by aurel 6 years ago.
1_bookmarks_3.patch (28.8 KB) - added by aurel 2 years ago.

Change History

comment:1 Changed 7 years ago by szaszg

This patch add a hotlist like bookmark list dialog to more user friendly management of bookmarks.
We can:

  • see a list of bookmarks with +1-1 line context of it
  • goto a bookmark
  • add current line as bookmark
  • remove a bookmark
  • flush displayed bookmark
  • sort bookmarks by usage count, "abc" and line number (default), can reverse the list
  • filter list: show only user bookmarks, or "found" bookmarks
  1. keybind.{h,c}
    • new CK_BookmarkList "enum"
  2. widget/listbox.{h,c}
    • new function: listbox_refresh_list() similar to listbox_set_list() but does not 'remove&free' the list 'just' refresh
    • changed function: listbox_set_list() now use listbox_refresh_list() after remove the 'old' list
  3. src/keybind-defaults.c, misc/mc.default.keymap
    • new hotkeys to start dialog: alt-shift-k and alt-shift-j
  4. editmenu.c
    • new menu entry: 'List bookmarks'
  5. editwidget.h, edit.c, edit-impl.h
    • new function declared: book_mark_list_show()
    • new struct member freq in edit_book_mark_t to accumulate "usage" count
    • changed function: edit_execute_cmd() - call book_mark_list_show() to show bookmark list dialog
  6. bookmark.c
    • new function: book_mark_list_show() - to show bookmark list dialog
    • new functions: list_init(), fill_list_box(), list_add_entry(), init_i18n_stuff(), fill_line_listbox() - to init list
    • new functions: list_listbox_callback(), list_callback(), list_handle_key(), list_button_callback() - to "run" dialog
    • new functions: update_list_title(), update_detail(), list_filter_color(), list_filter_none(), list_sort_line(), list_sort_freq(), list_sort_alpha(), list_entry_free2() - to help filter, sort, manage list
    • new function: list_entry_free() - to help free list data
Last edited 7 years ago by szaszg (previous) (diff)

comment:2 Changed 7 years ago by angel_il

looks good, but i have segfault
1) open file in mcedit (bookmark list must be empty)
2) press alt-shift-k
3) press key left, left, left
4) segfault

(More stack frames follow...)
(gdb) bt
#0 0x0810056b in book_mark_list_show (edit=0x820f148) at bookmark.c:864
#1 0x080d203c in edit_execute_cmd (edit=0x820f148, command=515, char_for_insertion=-1) at edit.c:4140
#2 0x080d3288 in edit_execute_key_command (edit=0x820f148, command=515, char_for_insertion=-1) at edit.c:3626
#3 0x080dfbd4 in edit_callback (w=0x820f148, sender=0x0, msg=MSG_KEY, parm=8267, data=0x0) at editwidget.c:1134
#4 0x08065c83 in send_message (data=0x0, parm=8267, msg=MSG_KEY, sender=0x0, w=<optimized out>)

at ../../lib/widget/widget-common.h:157

#5 dlg_key_event (d_key=8267, h=0x8208768) at dialog.c:515
#6 dlg_process_event (h=0x8208768, key=8267, event=0xbfffec50) at dialog.c:1244
#7 0x080661dd in frontend_run_dlg (h=0x8208768) at dialog.c:568
#8 run_dlg (h=0x8208768) at dialog.c:1275
#9 0x080e00f5 in edit_files (files=0x81ec290) at editwidget.c:1239
#10 0x080e0188 in edit_file (file_vpath=0x81738a0, line=0) at editwidget.c:1178
#11 0x0805f374 in do_edit_at_line (what_vpath=0x81738a0, internal=1, start_line=0) at cmd.c:794
#12 0x0805f48a in do_edit (what_vpath=0x81738a0) at cmd.c:182
#13 edit_cmd () at cmd.c:831
#14 0x0808b8bf in midnight_execute_cmd (sender=0x81eebe8, command=42) at midnight.c:1185

Last edited 7 years ago by angel_il (previous) (diff)

Changed 7 years ago by szaszg

screenshot: bookmark list dialog

Changed 7 years ago by szaszg

a "filemanager:hotlist" like bookmark list dialog

comment:3 Changed 7 years ago by szaszg

I updated the patch to fix SIGSEGV...

Changed 6 years ago by aurel

Original patch updated for current version

comment:4 Changed 6 years ago by aurel

Hello there.
Found this patch very nice, but it didn't worked for current version of mc.
So, I edited it.
http://www.midnight-commander.org/raw-attachment/ticket/2979/bookmarks.patch

comment:5 Changed 6 years ago by slavazanko

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

Changed 6 years ago by aurel

comment:6 follow-up: ↓ 7 Changed 6 years ago by aurel

https://www.midnight-commander.org/raw-attachment/ticket/2979/1_bookmarks_2.patch

Modified previous patch to work in new mc, where listbox has GQueue instead of GList to store it's items.

Added:
Unfortunately, patch has some bugs which cause segfaults. Hoping to fix it soon.

Last edited 6 years ago by aurel (previous) (diff)

comment:7 in reply to: ↑ 6 ; follow-up: ↓ 8 Changed 6 years ago by andrew_b

Replying to aurel:

Modified previous patch to work in new mc, where listbox has GQueue instead of GList to store it's items.

Don't use direct access to GQueue members. Use GQueue APIs instead.

comment:8 in reply to: ↑ 7 Changed 6 years ago by aurel

Replying to andrew_b:

Replying to aurel:

Modified previous patch to work in new mc, where listbox has GQueue instead of GList to store it's items.

Don't use direct access to GQueue members. Use GQueue APIs instead.

Thank you for advice, I'l try it.

Changed 6 years ago by aurel

Changed 2 years ago by aurel

Note: See TracTickets for help on using tickets.