[Midnight Commander] #2968: Raw/Parse and Format/Unformat do not work after C-f or C-b

21 views
Skip to first unread message

Ticket System

unread,
Feb 20, 2013, 2:36:09 PM2/20/13
to sza...@hu.inter.net, mc-...@googlegroups.com
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
------------------------------+--------------------------------
Reporter: szaszg | Owner:
Type: defect | Status: new
Priority: major | Milestone: Future Releases
Component: mcview | Version: master
Keywords: | Blocked By:
Blocking: | Branch state: no branch
Votes for changeset: |
------------------------------+--------------------------------
1. Open a man page (e.g. mc.1) in viewer (F3).
2. Now with F8 and F9 we can play around Raw/Parsed and
Formatted/Unformatted view
3. After open next file (C-f) and than open previouse file (C-b), now we
"view" the same file (e.g. mc.1)
4. '''but F8 and F9 do not work anymore'''

--
Ticket URL: <http://www.midnight-commander.org/ticket/2968>
Midnight Commander <http://www.midnight-commander.org>
Midnight Development Center

Ticket System

unread,
Mar 10, 2013, 7:20:21 PM3/10/13
to sza...@hu.inter.net, mc-...@googlegroups.com
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
--------------------------+---------------------------------------
Reporter: szaszg | Owner:
Type: defect | Status: new
Priority: major | Milestone: Future Releases
Component: mcview | Version: master
Resolution: | Keywords:
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+---------------------------------------

Comment (by szaszg):

The problem is:
- first mcviewer open the file with '''external helper''' (with: '''nroff
-c -Tlatin1 -mandoc''')
- this convert manpage to nroff formatted file with dblstike and underline
and so on...
- so mcview_display_nroff() can highlite the text
- after ctrl-f mcviewer open files without external helpers (only '''magic
mode''' works)
- mcview_display_nroff() see only the ''raw'' file (maximum uncompressed),
- so cannot highlite...

--
Ticket URL: <http://www.midnight-commander.org/ticket/2968#comment:1>

Ticket System

unread,
Mar 11, 2013, 6:56:19 PM3/11/13
to sza...@hu.inter.net, mc-...@googlegroups.com
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
--------------------------+---------------------------------------
Reporter: szaszg | Owner:
Type: defect | Status: new
Priority: major | Milestone: Future Releases
Component: mcview | Version: master
Resolution: | Keywords:
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+---------------------------------------

Comment (by szaszg):

I attached a patch:
ext.{h,c}:
- regex_command renamed to regex_command_cb() and has a new argument
(callback) wich called, when not NULL and 'external helper command'
constructed (instead of exec_extension_view()).
- regex_command() call regex_command_cb() with NULL callback
- exec_extension() has a new argument (callback)
actions_cmd.c:
- new function: mcview_regex_cmd_cb() - callback for regex_command()
to save "cmd" and others
- mcview_load_next_prev() now uses regex_command_cb() to load
next/prev file with "external helper" if any

--
Ticket URL: <http://www.midnight-commander.org/ticket/2968#comment:2>

Ticket System

unread,
Mar 12, 2013, 5:03:25 AM3/12/13
to sza...@hu.inter.net, mc-...@googlegroups.com
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
--------------------------+---------------------------------------
Reporter: szaszg | Owner:
Type: defect | Status: new
Priority: major | Milestone: Future Releases
Component: mcview | Version: master
Resolution: | Keywords:
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+---------------------------------------

Comment (by andrew_b):

You introduced several variables:
{{{
+static vfs_path_t *temp_file_name_vpath = NULL;
+static char *cmd = NULL;
+static int written_nonspace = 0;
}}}
These variables are shared between all viewers opened at the same time. Is
everything OK in this case?

--
Ticket URL: <http://www.midnight-commander.org/ticket/2968#comment:3>

Ticket System

unread,
Mar 12, 2013, 10:15:08 AM3/12/13
to sza...@hu.inter.net, mc-...@googlegroups.com
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
--------------------------+---------------------------------------
Reporter: szaszg | Owner:
Type: defect | Status: new
Priority: major | Milestone: Future Releases
Component: mcview | Version: master
Resolution: | Keywords:
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+---------------------------------------

Comment (by szaszg):

Replying to [comment:3 andrew_b]:

> These variables are shared between all viewers opened at the same time.
Is everything OK in this case?

This variables exist to store the data needed for open the file with
external helper. mcview_regex_cmd_cb() fill this variables, when
regex_command_cb() call it. After mcview_load() we free them. So these
variables just for temp storage of the command filename and vpath...

--
Ticket URL: <http://www.midnight-commander.org/ticket/2968#comment:4>

Ticket System

unread,
Mar 12, 2013, 1:58:12 PM3/12/13
to sza...@hu.inter.net, mc-...@googlegroups.com
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
--------------------------+---------------------------------------
Reporter: szaszg | Owner:
Type: defect | Status: new
Priority: major | Milestone: Future Releases
Component: mcview | Version: master
Resolution: | Keywords:
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+---------------------------------------

Comment (by andrew_b):

Unfortunately, your patch doesn't resolve the problem.
For example, go to the directory with man pages:
{{{
mc/BUILD_ROOT/INSTALL_ROOT/share/man/man1:

mc.1
mcedit.1
mcview.1
}}}
Press F3 on mc.1. You see parsed man page.
Press C-f. You see parsed man page mcedit.1.
Press F8 to switch to the raw mode. You see the raw mcedit.1. It's OK.
Press F8 to switch back to the parsed mode. You can see the warning like
following:
{{{/bin/sh: /tmp/.private/andrew/mc-andrew/mcext1FQQTW: No such file or
directory}}}.
Press Enter. The error {{{Empty output from child filter}}} is raised.
Press Enter. You see the clean viewer area instead of parsed mcedit.1.

--
Ticket URL: <http://www.midnight-commander.org/ticket/2968#comment:5>

Ticket System

unread,
Mar 14, 2013, 8:19:08 AM3/14/13
to sza...@hu.inter.net, mc-...@googlegroups.com
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
--------------------------+---------------------------------------
Reporter: szaszg | Owner:
Type: defect | Status: new
Priority: major | Milestone: Future Releases
Component: mcview | Version: master
Resolution: | Keywords:
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+---------------------------------------

Comment (by szaszg):

Now, i replace the diff with a new one. I hope this fix all the problem in
this ticket and in ticket#2090.

1. filemanager/ext.{c,h}
- new struct: ext_command_cache_t
- new array: ext_command_cache_t
ext_command_cache[EXT_COMMAND_CACHE_SIZE]; to cache filter commands'
properties
- new variable: int command_cache_idx; to manage cache
- changed function: exec_extension_view() does not mc_unlink() filter
script anymore
- new function: flush_command_cache_member() to remove one cached
filter command
- new function: check_command_cache() lookup a filename in cache (to
avoid multiple command filter generation) and update 'usage' number
- new function: add_command_cache() add a new entry to cache (if
needed). If cache is full, replace the first less frequent used entry with
new
- new function: ext_get_command_cache() to get a command from cache
- new function: ext_flush_command_cache() remove all entry from
command cache (and mc_unlink() all filter file)
- changed function: exec_extension() - save the generated filters
properties into the command cache
* new argument: int *cmd_idx - set this to -1 or the cache index of
filter command if generated
* new argument: gboolean run_dialog - if TRUE function startup a new
mcviewer dialog
- changed function: regex_command() - now just call regex_command2()
with *cmd_idx = NULL and run_dialog = TRUE
- new function: regex_command2() - this is the old regex_command()
just changed a little bit - at the beginning check: there is a cached
command for the file, if any just use it
* new argument: int *cmd_idx - see exec_extension()
* new argument: gboolean run_dialog - see exec_extension()
2. filemanager/midnight.c
- changed function: do_nc() - flush command cache before exit
3. viewer/actions_cmd.c
- changed function: mcview_load_next_prev() - now it can use
regex_command2() to open files with external helpers
4. viewer/lib.c
- changed function: mcview_toggle_magic_mode - now it can use
regex_command2() to open files with external helpers

--
Ticket URL: <http://www.midnight-commander.org/ticket/2968#comment:6>

Ticket System

unread,
Mar 15, 2013, 11:07:30 AM3/15/13
to sza...@hu.inter.net, mc-...@googlegroups.com, go...@polanet.pl
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
--------------------------+---------------------------------------
Reporter: szaszg | Owner:
Type: defect | Status: new
Priority: major | Milestone: Future Releases
Component: mcview | Version: master
Resolution: | Keywords:
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+---------------------------------------
Changes (by gotar):

* cc: gotar@… (added)


--
Ticket URL: <http://www.midnight-commander.org/ticket/2968#comment:7>

Ticket System

unread,
Apr 5, 2013, 11:29:23 AM4/5/13
to sza...@hu.inter.net, mc-...@googlegroups.com, go...@polanet.pl
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
--------------------------+---------------------------------------
Reporter: szaszg | Owner:
Type: defect | Status: new
Priority: major | Milestone: Future Releases
Component: mcview | Version: master
Resolution: | Keywords:
Blocked By: | Blocking:
Branch state: on review | Votes for changeset:
--------------------------+---------------------------------------
Changes (by andrew_b):

* branch_state: no branch => on review


Comment:

The offered patch is overcomplicated. I implemented another decision.

Branch: 2968_viewer_next_prev_mode.
Initial changeset:4495957319bf14735e95841e37e9abb5559b2457

--
Ticket URL: <http://www.midnight-commander.org/ticket/2968#comment:8>

Ticket System

unread,
Apr 11, 2013, 8:02:02 AM4/11/13
to sza...@hu.inter.net, andrew....@gmail.com, mc-...@googlegroups.com, go...@polanet.pl
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
--------------------------+---------------------------------------
Reporter: szaszg | Owner: andrew_b
Type: defect | Status: assigned
Priority: major | Milestone: Future Releases
Component: mcview | Version: master
Resolution: | Keywords:
Blocked By: | Blocking:
Branch state: on review | Votes for changeset:
--------------------------+---------------------------------------
Changes (by slavazanko):

* owner: => andrew_b
* status: new => assigned


--
Ticket URL: <http://www.midnight-commander.org/ticket/2968#comment:9>

Ticket System

unread,
Apr 11, 2013, 8:11:28 AM4/11/13
to sza...@hu.inter.net, andrew....@gmail.com, mc-...@googlegroups.com, go...@polanet.pl
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
--------------------------+--------------------------------
Reporter: szaszg | Owner: andrew_b
Type: defect | Status: accepted
Priority: major | Milestone: 4.8.9
Component: mcview | Version: master
Resolution: | Keywords:
Blocked By: | Blocking:
Branch state: on review | Votes for changeset:
--------------------------+--------------------------------
Changes (by andrew_b):

* status: assigned => accepted
* milestone: Future Releases => 4.8.9


--
Ticket URL: <http://www.midnight-commander.org/ticket/2968#comment:10>

Ticket System

unread,
Apr 11, 2013, 8:20:14 AM4/11/13
to sza...@hu.inter.net, andrew....@gmail.com, mc-...@googlegroups.com, go...@polanet.pl
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
--------------------------+----------------------------------
Reporter: szaszg | Owner: andrew_b
Type: defect | Status: accepted
Priority: major | Milestone: 4.8.9
Component: mcview | Version: master
Resolution: | Keywords:
Blocked By: | Blocking:
Branch state: on review | Votes for changeset: slavazanko
--------------------------+----------------------------------
Changes (by slavazanko):

* votes: => slavazanko


--
Ticket URL: <http://www.midnight-commander.org/ticket/2968#comment:11>

Ticket System

unread,
Apr 11, 2013, 12:30:51 PM4/11/13
to sza...@hu.inter.net, andrew....@gmail.com, mc-...@googlegroups.com, go...@polanet.pl
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
-------------------------+-------------------------------------------
Reporter: szaszg | Owner: andrew_b
Type: defect | Status: accepted
Priority: major | Milestone: 4.8.9
Component: mcview | Version: master
Resolution: | Keywords:
Blocked By: | Blocking:
Branch state: approved | Votes for changeset: slavazanko angel_il
-------------------------+-------------------------------------------
Changes (by angel_il):

* votes: slavazanko => slavazanko angel_il
* branch_state: on review => approved


--
Ticket URL: <http://www.midnight-commander.org/ticket/2968#comment:12>

Ticket System

unread,
Apr 12, 2013, 1:17:40 AM4/12/13
to sza...@hu.inter.net, andrew....@gmail.com, mc-...@googlegroups.com, go...@polanet.pl
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
-----------------------+----------------------------------------
Reporter: szaszg | Owner: andrew_b
Type: defect | Status: testing
Priority: major | Milestone: 4.8.9
Component: mcview | Version: master
Resolution: fixed | Keywords:
Blocked By: | Blocking:
Branch state: merged | Votes for changeset: committed-master
-----------------------+----------------------------------------
Changes (by andrew_b):

* status: accepted => testing
* votes: slavazanko angel_il => committed-master
* resolution: => fixed
* branch_state: approved => merged


Comment:

Merged to master: [02265113cd5f99a5c2efbd249cd73ad1b04d4051].
{{{
git log --pretty=oneline 6cdfa25..0226511
}}}

--
Ticket URL: <http://www.midnight-commander.org/ticket/2968#comment:13>

Ticket System

unread,
Apr 12, 2013, 1:20:33 AM4/12/13
to sza...@hu.inter.net, andrew....@gmail.com, mc-...@googlegroups.com, go...@polanet.pl
#2968: Raw/Parse and Format/Unformat do not work after C-f or C-b
-----------------------+----------------------------------------
Reporter: szaszg | Owner: andrew_b
Type: defect | Status: closed
Priority: major | Milestone: 4.8.9
Component: mcview | Version: master
Resolution: fixed | Keywords:
Blocked By: | Blocking:
Branch state: merged | Votes for changeset: committed-master
-----------------------+----------------------------------------
Changes (by andrew_b):

* status: testing => closed


--
Ticket URL: <http://www.midnight-commander.org/ticket/2968#comment:14>

Reply all
Reply to author
Forward
0 new messages