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 270396 - Prompt string is displayed incorrectly on "Open in Terminal" action
Summary: Prompt string is displayed incorrectly on "Open in Terminal" action
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Terminalemulator (show other bugs)
Version: Dev
Hardware: PC Linux
: P3 normal (vote)
Assignee: ilia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-14 07:06 UTC by ilia
Modified: 2017-07-20 17:51 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot (8.57 KB, image/png)
2017-04-14 07:06 UTC, ilia
Details
PS1 (5.14 KB, image/png)
2017-06-13 08:37 UTC, ilia
Details
invalid patch (4.65 KB, patch)
2017-06-21 10:17 UTC, ilia
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ilia 2017-04-14 07:06:21 UTC
1) Select a file with a long path in projects
2) Alt + Shift + K (open in terminal)
3) first string "wraps itself" (see screenshot)

After first symbol is typed prompt "unwraps".
Comment 1 ilia 2017-04-14 07:06:42 UTC
Created attachment 164106 [details]
Screenshot
Comment 2 ilia 2017-06-13 08:37:22 UTC
This happens if PS1 is long too.

to reproduce insert line to the end of ~/.bashrc
PS1=0123456789AAAAAAAAAA0123456789BBBBBBBBBB0123456789CCCCCCCCCC0123456789DDDDDDEEEEEEFFFFFFGGGGGG

Open Terminal. Same behavior, see screenshot.
Comment 3 ilia 2017-06-13 08:37:49 UTC
Created attachment 164518 [details]
PS1
Comment 4 ilia 2017-06-13 09:55:04 UTC
Log is attached below.
As I can see somehow op_carriage_return is handled. But where is no CR or LF in PS1...

op_cwd(/tmp)
op_char('0' 0x30) maps to '0' 0x30
op_char(): st.cursor.col 0 insertion_col 0
op_char('1' 0x31) maps to '1' 0x31
op_char(): st.cursor.col 1 insertion_col 1
op_char('2' 0x32) maps to '2' 0x32
op_char(): st.cursor.col 2 insertion_col 2
op_char('3' 0x33) maps to '3' 0x33
op_char(): st.cursor.col 3 insertion_col 3
op_char('4' 0x34) maps to '4' 0x34
op_char(): st.cursor.col 4 insertion_col 4
op_char('5' 0x35) maps to '5' 0x35
op_char(): st.cursor.col 5 insertion_col 5
op_char('6' 0x36) maps to '6' 0x36
op_char(): st.cursor.col 6 insertion_col 6
op_char('7' 0x37) maps to '7' 0x37
op_char(): st.cursor.col 7 insertion_col 7
op_char('8' 0x38) maps to '8' 0x38
op_char(): st.cursor.col 8 insertion_col 8
op_char('9' 0x39) maps to '9' 0x39
op_char(): st.cursor.col 9 insertion_col 9
op_char('A' 0x41) maps to 'A' 0x41
op_char(): st.cursor.col 10 insertion_col 10
op_char('A' 0x41) maps to 'A' 0x41
op_char(): st.cursor.col 11 insertion_col 11
op_char('A' 0x41) maps to 'A' 0x41
op_char(): st.cursor.col 12 insertion_col 12
op_char('A' 0x41) maps to 'A' 0x41
op_char(): st.cursor.col 13 insertion_col 13
op_char('A' 0x41) maps to 'A' 0x41
op_char(): st.cursor.col 14 insertion_col 14
op_char('A' 0x41) maps to 'A' 0x41
op_char(): st.cursor.col 15 insertion_col 15
op_char('A' 0x41) maps to 'A' 0x41
op_char(): st.cursor.col 16 insertion_col 16
op_char('A' 0x41) maps to 'A' 0x41
op_char(): st.cursor.col 17 insertion_col 17
op_char('A' 0x41) maps to 'A' 0x41
op_char(): st.cursor.col 18 insertion_col 18
op_char('A' 0x41) maps to 'A' 0x41
op_char(): st.cursor.col 19 insertion_col 19
op_char('0' 0x30) maps to '0' 0x30
op_char(): st.cursor.col 20 insertion_col 20
op_char('1' 0x31) maps to '1' 0x31
op_char(): st.cursor.col 21 insertion_col 21
op_char('2' 0x32) maps to '2' 0x32
op_char(): st.cursor.col 22 insertion_col 22
op_char('3' 0x33) maps to '3' 0x33
op_char(): st.cursor.col 23 insertion_col 23
op_char('4' 0x34) maps to '4' 0x34
op_char(): st.cursor.col 24 insertion_col 24
op_char('5' 0x35) maps to '5' 0x35
op_char(): st.cursor.col 25 insertion_col 25
op_char('6' 0x36) maps to '6' 0x36
op_char(): st.cursor.col 26 insertion_col 26
op_char('7' 0x37) maps to '7' 0x37
op_char(): st.cursor.col 27 insertion_col 27
op_char('8' 0x38) maps to '8' 0x38
op_char(): st.cursor.col 28 insertion_col 28
op_char('9' 0x39) maps to '9' 0x39
op_char(): st.cursor.col 29 insertion_col 29
op_char('B' 0x42) maps to 'B' 0x42
op_char(): st.cursor.col 30 insertion_col 30
op_char('B' 0x42) maps to 'B' 0x42
op_char(): st.cursor.col 31 insertion_col 31
op_char('B' 0x42) maps to 'B' 0x42
op_char(): st.cursor.col 32 insertion_col 32
op_char('B' 0x42) maps to 'B' 0x42
op_char(): st.cursor.col 33 insertion_col 33
op_char('B' 0x42) maps to 'B' 0x42
op_char(): st.cursor.col 34 insertion_col 34
op_char('B' 0x42) maps to 'B' 0x42
op_char(): st.cursor.col 35 insertion_col 35
op_char('B' 0x42) maps to 'B' 0x42
op_char(): st.cursor.col 36 insertion_col 36
op_char('B' 0x42) maps to 'B' 0x42
op_char(): st.cursor.col 37 insertion_col 37
op_char('B' 0x42) maps to 'B' 0x42
op_char(): st.cursor.col 38 insertion_col 38
op_char('B' 0x42) maps to 'B' 0x42
op_char(): st.cursor.col 39 insertion_col 39
op_char('0' 0x30) maps to '0' 0x30
op_char(): st.cursor.col 40 insertion_col 40
op_char('1' 0x31) maps to '1' 0x31
op_char(): st.cursor.col 41 insertion_col 41
op_char('2' 0x32) maps to '2' 0x32
op_char(): st.cursor.col 42 insertion_col 42
op_char('3' 0x33) maps to '3' 0x33
op_char(): st.cursor.col 43 insertion_col 43
op_char('4' 0x34) maps to '4' 0x34
op_char(): st.cursor.col 44 insertion_col 44
op_char('5' 0x35) maps to '5' 0x35
op_char(): st.cursor.col 45 insertion_col 45
op_char('6' 0x36) maps to '6' 0x36
op_char(): st.cursor.col 46 insertion_col 46
op_char('7' 0x37) maps to '7' 0x37
op_char(): st.cursor.col 47 insertion_col 47
op_char('8' 0x38) maps to '8' 0x38
op_char(): st.cursor.col 48 insertion_col 48
op_char('9' 0x39) maps to '9' 0x39
op_char(): st.cursor.col 49 insertion_col 49
op_char('C' 0x43) maps to 'C' 0x43
op_char(): st.cursor.col 50 insertion_col 50
op_char('C' 0x43) maps to 'C' 0x43
op_char(): st.cursor.col 51 insertion_col 51
op_char('C' 0x43) maps to 'C' 0x43
op_char(): st.cursor.col 52 insertion_col 52
op_char('C' 0x43) maps to 'C' 0x43
op_char(): st.cursor.col 53 insertion_col 53
op_char('C' 0x43) maps to 'C' 0x43
op_char(): st.cursor.col 54 insertion_col 54
op_char('C' 0x43) maps to 'C' 0x43
op_char(): st.cursor.col 55 insertion_col 55
op_char('C' 0x43) maps to 'C' 0x43
op_char(): st.cursor.col 56 insertion_col 56
op_char('C' 0x43) maps to 'C' 0x43
op_char(): st.cursor.col 57 insertion_col 57
op_char('C' 0x43) maps to 'C' 0x43
op_char(): st.cursor.col 58 insertion_col 58
op_char('C' 0x43) maps to 'C' 0x43
op_char(): st.cursor.col 59 insertion_col 59
op_char('0' 0x30) maps to '0' 0x30
op_char(): st.cursor.col 60 insertion_col 60
op_char('1' 0x31) maps to '1' 0x31
op_char(): st.cursor.col 61 insertion_col 61
op_char('2' 0x32) maps to '2' 0x32
op_char(): st.cursor.col 62 insertion_col 62
op_char('3' 0x33) maps to '3' 0x33
op_char(): st.cursor.col 63 insertion_col 63
op_char('4' 0x34) maps to '4' 0x34
op_char(): st.cursor.col 64 insertion_col 64
op_char('5' 0x35) maps to '5' 0x35
op_char(): st.cursor.col 65 insertion_col 65
op_char('6' 0x36) maps to '6' 0x36
op_char(): st.cursor.col 66 insertion_col 66
op_char('7' 0x37) maps to '7' 0x37
op_char(): st.cursor.col 67 insertion_col 67
op_char('8' 0x38) maps to '8' 0x38
op_char(): st.cursor.col 68 insertion_col 68
op_char('9' 0x39) maps to '9' 0x39
op_char(): st.cursor.col 69 insertion_col 69
op_char('D' 0x44) maps to 'D' 0x44
op_char(): st.cursor.col 70 insertion_col 70
op_char('D' 0x44) maps to 'D' 0x44
op_char(): st.cursor.col 71 insertion_col 71
op_char('D' 0x44) maps to 'D' 0x44
op_char(): st.cursor.col 72 insertion_col 72
op_char('D' 0x44) maps to 'D' 0x44
op_char(): st.cursor.col 73 insertion_col 73
op_char('D' 0x44) maps to 'D' 0x44
op_char(): st.cursor.col 74 insertion_col 74
op_char('D' 0x44) maps to 'D' 0x44
op_char(): st.cursor.col 75 insertion_col 75
op_char('E' 0x45) maps to 'E' 0x45
op_char(): st.cursor.col 76 insertion_col 76
op_char('E' 0x45) maps to 'E' 0x45
op_char(): st.cursor.col 77 insertion_col 77
op_char('E' 0x45) maps to 'E' 0x45
op_char(): st.cursor.col 78 insertion_col 78
op_char('E' 0x45) maps to 'E' 0x45
op_char(): st.cursor.col 79 insertion_col 79
op_char('E' 0x45) maps to 'E' 0x45
op_char(): st.cursor.col 80 insertion_col 80
op_carriage_return
op_char('E' 0x45) maps to 'E' 0x45
op_char(): st.cursor.col 0 insertion_col 0
op_char('E' 0x45) maps to 'E' 0x45
op_char(): st.cursor.col 1 insertion_col 1
op_char('F' 0x46) maps to 'F' 0x46
op_char(): st.cursor.col 2 insertion_col 2
op_char('F' 0x46) maps to 'F' 0x46
op_char(): st.cursor.col 3 insertion_col 3
op_char('F' 0x46) maps to 'F' 0x46
op_char(): st.cursor.col 4 insertion_col 4
op_char('F' 0x46) maps to 'F' 0x46
op_char(): st.cursor.col 5 insertion_col 5
op_char('F' 0x46) maps to 'F' 0x46
op_char(): st.cursor.col 6 insertion_col 6
op_char('F' 0x46) maps to 'F' 0x46
op_char(): st.cursor.col 7 insertion_col 7
op_char('G' 0x47) maps to 'G' 0x47
op_char(): st.cursor.col 8 insertion_col 8
op_char('G' 0x47) maps to 'G' 0x47
op_char(): st.cursor.col 9 insertion_col 9
op_char('G' 0x47) maps to 'G' 0x47
op_char(): st.cursor.col 10 insertion_col 10
op_char('G' 0x47) maps to 'G' 0x47
op_char(): st.cursor.col 11 insertion_col 11
op_char('G' 0x47) maps to 'G' 0x47
op_char(): st.cursor.col 12 insertion_col 12
op_char('G' 0x47) maps to 'G' 0x47
op_char(): st.cursor.col 13 insertion_col 13
Comment 5 ilia 2017-06-13 12:37:17 UTC
Running strace on [1] from external terminal - output is correct.
Seems that it's not pty issue (fortunately)

[1] /tmp/dlight_ilia/2f28a8ba/1867006118/pty --dir /home/ilia/code/cnd-main/terminal.nb --set-erase-key --env DYLD_LIBRARY_PATH= --env LD_LIBRARY_PATH= --env PROMPT_COMMAND='printf "]3;${PWD}"; ideopen() { printf "]10;ext[::] ideopen $*;"; printf "Opening $# file(s) ... ";}' --env TERM=xterm /bin/bash --login
Comment 6 ilia 2017-06-21 10:17:18 UTC
Created attachment 164587 [details]
invalid patch

I thought something like the attached patch can solve the problem (notify Term about the fact that 'stty rows ... cols ...' command exited successfully and expect Term to redraw itself/recalculate buffer rows/cols, whatever).
But it turns out that terminal sees and draws the correct state of the text on screen.

For some reason bash doesn't react immediately to ROWS and COLS change (opposed to, i.e., vi)  and send  correct lines only after some char is typed.
Comment 7 ilia 2017-06-28 09:37:43 UTC
A pty can be changed so it sets the correct size immediately when creating a new pty proccess.
Comment 8 Quality Engineering 2017-07-20 17:51:02 UTC
Integrated into 'main-silver', will be available in build *201707201608* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/46d4590e4a52
User: Ilia Gromov <ilia@netbeans.org>
Log: Partial fix for #270396 - Prompt string is displayed incorrectly on "Open in Terminal" action. First call is still slow -> buggy, need to synchronize it somehow