This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 253541 - mc is borken in terminal
Summary: mc is borken in terminal
Status: RESOLVED INVALID
Alias: None
Product: cnd
Classification: Unclassified
Component: Terminalemulator (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: ivan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-17 12:46 UTC by rniestroj
Modified: 2016-10-08 05:25 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
mc broken display on arrow up or arrow down (61.29 KB, image/jpeg)
2015-07-17 12:46 UTC, rniestroj
Details
mc -a displays xml with white background (42.17 KB, image/jpeg)
2015-07-20 14:52 UTC, rniestroj
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rniestroj 2015-07-17 12:46:56 UTC
Created attachment 154692 [details]
mc broken display on arrow up or arrow down

mc is broken in terminal. Remote OS is CentOS 7.

[root@demo Pobrane]# mc --version
GNU Midnight Commander 4.7.0.2
Wirtualny System Plików: tarfs, extfs, cpiofs, ftpfs, fish, mcfs, smbfs
Z wbudowanym edytorem
Używanie biblioteki S-Lang zainstalowanej w systemie z bazą danych terminfo
Z domyślną obsługą podpowłoki
Z możliwością wykonywania zadań w tle
Z obsługą myszy w oknie xterma i na konsoli linuksowej
Z obsługą wielu języków
Z obsługą wielu stron kodowych
Data types: char 8 int 32 long 64 void * 64 off_t 64 ecs_char 8

Basic keyboard shortcuts are not working for example F4, F5, F6 are not working because i think that they conflict with NetBeans keyboard shortcuts. For example F3 and F10 are working. 

Also display i a bit broken. When i move with the arrow keys the whole listing move one char to the left. Resizing the terminal removes the bad display. See attached screenshot.
Comment 1 soldatov 2015-07-17 12:56:42 UTC
(In reply to rniestroj from comment #0)
> Basic keyboard shortcuts are not working for example F4, F5, F6 are not
> working because i think that they conflict with NetBeans keyboard shortcuts.
> For example F3 and F10 are working.
See "Ignore Global Shortcuts" checkbox in Miscellaneous|Terminal tab in Options window

> 
> Also display i a bit broken. When i move with the arrow keys the whole
> listing move one char to the left. Resizing the terminal removes the bad
> display. See attached screenshot.
Do you same problem when you are using "mc -a" command?
Comment 2 ilia 2015-07-20 08:28:58 UTC
> for example F4, F5, F6 are not working

It was decided to ignore and forward a limited set of hotkeys in Terminal (Step <...> for debugging and Ctrl+Tab for switching active windows.

This behavior can be disabled as it was described in Comment 1
Comment 3 rniestroj 2015-07-20 14:49:25 UTC
OK. I understand the shortcuts. Also mc -a is working correctly in the files list. However mc -a is working badly when viewing xml files. It makes the background white which makes the xml unreadable. I will try to add an additional attachment.
Comment 4 rniestroj 2015-07-20 14:52:47 UTC
Created attachment 154733 [details]
mc -a displays xml with white background
Comment 5 ivan 2016-10-08 04:17:22 UTC
(In reply to rniestroj from comment #4)
> Created attachment 154733 [details]
> mc -a displays xml with white background

I can reproduce the problem. Using -a is crucial.
If you run the TermApp project (lib.terminalemulator/examples/TermApp)
with the -d option and then run 'mc' on some simple xml like,

    <?xml version="1.0" encoding="UTF-8"?>

    <!-- A comment -->

    <record>
        <name>Ivan</name>
        <last>Soleimanipour</last>
    </record>

for the "<!-- A comment -->" part you'll get

...
op_attr(92)
op_attr(49)
op_char('<' 0x3c) maps to '<' 0x3c
op_char(): st.cursor.col 0 insertion_col 0
op_char('!' 0x21) maps to '!' 0x21
op_char(): st.cursor.col 1 insertion_col 1
op_char('-' 0x2d) maps to '-' 0x2d
op_char(): st.cursor.col 2 insertion_col 2
op_char('-' 0x2d) maps to '-' 0x2d
op_char(): st.cursor.col 3 insertion_col 3
op_char(' ' 0x20) maps to ' ' 0x20
op_char(): st.cursor.col 4 insertion_col 4
op_char('A' 0x41) maps to 'A' 0x41
...

The crucial part is:
op_attr(92)     bright fg -> green
op_attr(49)     bgcolor clear -> default
Comment 6 ivan 2016-10-08 04:57:41 UTC
[ continuing after keyboard snafu's ]

The crucial part is:
op_attr(92)     bright fg -> green
op_attr(49)     bgcolor clear -> default

So the white is the default BG color being reverted to ... 
the original terminal has white as it's BG!
Ergo some other sequence must be setting the default BG color
and NB terminal isn't honoring that.

    We can look for unimplemented sequences as follows:
    From the TermApp context menu, check LogSequences, then
    run mc and edit an xml file. Then from the TermApp 
    context menu choose  "Dump Sequences". This will
    create files /tmp/term-sequence-*. These, in turn,
    can be viewed by running the TermTester project 
    (lib.terminalemulator/examples/TermApp) and clicking on
    the Sequences button. This will show two columns, 
    Completed sequences and Unrecognized sequences:
        \ESC[?%dh
        \ESC[?%dl
        \ESC[?%ds
    You can get an idea of the actual %d's by unchecking the FilterNumbers
    checkbox and we get these:
        \ESC[?1001s     Save DEC Private Mode Values. Px are the same as for
                        DECSET.
                        1 0 0 1  -> Use Hilite Mouse Tracking.
        \ESC[?1002h     Use Cell Motion Mouse Tracking
        \ESC[?1006h     Enable SGR Mouse Mode.
        \ESC[?1049h     Save cursor as in DECSC and use Alternate Screen Buffer 
                        clearing it first
        \ESC[?1049l     Use Normal Screen Buffer and restore cursor as in DECSC...
        \ESC[?2004h     Set bracketed paste mode
        \ESC[?47h       Use Alternate Screen Buffer
    But none of these fit the "set default BG color" sequence.
    
    Sooo, need ore investigation.
Comment 7 ivan 2016-10-08 05:25:42 UTC
This isn't a problem in our terminal.
When rendering tags (e.g. <name>) 'mc' sends the 
control sequence
    op_attr(49)     bgcolor clear -> default
In the case of NB Term the default BG is white which is why
you see all that white background for tags.
A typical xterm/konsole/gnome-terminal/xfce-terminal is started with black
as BG so the tags gets rendered with a black BG.

If you start xterm like this, "xterm -fg black -bg white" you'll
see "mc -a" misbehaving in the same way.
Conversely if you use Tools->Options->Miscellaneous->Terminal
and swap the fb/bg colors you'll see the tags rendered with
black backgrounds.