#2514 closed bug (fixed)
Enlarged Terminal wraps input line overwriting beginning
Reported by: | stippi | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta2 |
Component: | Applications/Command Line Tools | Version: | R1/pre-alpha1 |
Keywords: | Cc: | adek336@… | |
Blocked By: | Blocking: | ||
Platform: | All |
Description
Make the Terminal wider and enter a longer command line. Before you get to the right end of the window, the cursor will be replaced to the beginning of the line overwriting what you already wrote. Maybe the wrap-around happens at about the position of the original Terminal width.
Attachments (1)
Change History (22)
comment:1 by , 16 years ago
Component: | Applications/Terminal → - General |
---|---|
Owner: | changed from | to
by , 16 years ago
Attachment: | screen1.png added |
---|
long lines in terminal aren't always displayed correctly
comment:2 by , 16 years ago
This can also be seen if you type really long commands and then recall them later by using the cursor up/down keys. See attached screenshot. Note that the command should read:
./configure --prefix=/boot/common LDFLAGS=-L/boot/common/lib CPPFLAGS=-I/boot/common/include
as is actually executed as it should be, just that it's being displayed wrong. This is on hrev26990.
comment:3 by , 16 years ago
Cc: | added |
---|
comment:4 by , 16 years ago
src/bin/bash/lib/readline/terminal.c: function _rl_get_screen_size() is called (probably from a SIGWINCH handler) upon terminal resize when no command is being executed. Upon terminal resizing, neither when a command is being executed nor after returning from it, does _rl_get_screen_size() get called; and thus the dimensions aren't updated.
The first take at the problem is to update screen size after returning from a command, there's probably a better way though.
Index: src/bin/bash/eval.c =================================================================== --- src/bin/bash/eval.c (revision 28658) +++ src/bin/bash/eval.c (working copy) @@ -140,7 +140,8 @@ executing = 1; stdin_redir = 0; execute_command (current_command); + rl_resize_terminal(); exec_done: if (current_command)
follow-up: 6 comment:5 by , 16 years ago
Why is vendor/bash/current is of version 3.2 while trunk/src/bin/bash contains the 2.05b version?
comment:6 by , 16 years ago
Replying to Adek336:
Why is vendor/bash/current is of version 3.2 while trunk/src/bin/bash contains the 2.05b version?
There is a hope to get the mainstream bash running on Haiku :)
comment:7 by , 16 years ago
The version in trunk/bin isn't the mainstream one?
---
lib/sh/Makefile and lib/tilde/Makefile reference /Dano/home/obos/... which prevent bash from compiling on Linux (compiles on Linux when changed to ../..).
comment:8 by , 16 years ago
I found the proper solution.
The file ~/.bashrc must contain the line
shopt -s checkwinsize
Also under a linux install, you will notice that removing this line from ~/.bashrc enables one to reproduce the bug under linux.
comment:9 by , 16 years ago
Um, Bash on Haiku doesn't seem to pick up the ~/.bashrc file, so you have to enter the command manually to a running bash, that helps.
comment:10 by , 16 years ago
~/.bashrc is picked up after all, just not by the login shell.
You have to append that shopt line to both /etc/profile for login shells and ~/.bashrc for non login shells.
comment:11 by , 16 years ago
Currently bash will ignore /etc/bashrc and /etc/bash.bashrc, perhaps shopt -s checkwinsize should be written in one of these two, as a generally useful option, while ~/.bashrc would be left empty for custom user use.
comment:12 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in hrev28772, thanks! It's now in /etc/profile only (and therefore would be used by other shells as well - /etc/bashrc would be the preferred location).
comment:13 by , 16 years ago
Currently, running a second bash from the terminal by typing bash<enter> invokes a non-login shell which ignores /etc/profile (which is sourced only by login shells). So, for example, "ls" is colorful in a login shell, but in a non-login shell.
The following makes non-login shells source /etc/bashrc:
Index: src/bin/bash/config-top.h =================================================================== --- src/bin/bash/config-top.h (wersja 28736) +++ src/bin/bash/config-top.h (kopia robocza) @@ -73,7 +73,7 @@ #define KSH_COMPATIBLE_SELECT /* System-wide .bashrc file for interactive shells. */ -/* #define SYS_BASHRC "/etc/bash.bashrc" */ +#define SYS_BASHRC "/etc/bashrc" /* System-wide .bash_logout for login shells. */ /* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */
After this, one can move the general parts of /etc/profile to /etc/bashrc (that is, everything from alias ls=... down to shopt -s checkwinsize) and add the line
source /etc/bashrc
to /etc/profile.
comment:14 by , 16 years ago
But other shells still see the bashrc specific command "source /etc/bashrc" in /etc/profile.
So bash should load not only /etc/profile but also /etc/bash_profile (which would consist only of "source /etc/bashrc") for login shells.
comment:16 by , 16 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
ping ! that patch divides the profile code into general and bash-specific. It only needs a change to the build system so that the new files are copied to /etc.
comment:17 by , 16 years ago
I'm not really fond of that solution, it's a bit too invasive and unnecessary IMO. AFAICT our current /etc/profile is pretty much POSIX shell conformant, so other shells shouldn't have a problem with it. Either way, Haiku comes with bash, and there won't be another shell. If a user wants to install his own shell, it's his problem.
Why not just enable /etc/bashrc, and put the shopt in both of them?
comment:18 by , 13 years ago
Component: | - General → Applications/Command Line Tools |
---|
comment:19 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | reopened → assigned |
comment:20 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
According to bash docs, checkwinsize is enabled by default in current versions (https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html). No further change needed here.
comment:21 by , 5 years ago
Milestone: | R1 → R1/beta2 |
---|
Assign tickets with status=closed and resolution=fixed within the R1/beta2 development window to the R1/beta2 Milestone
Can't reproduce the bug according to your description. I can reproduce it though, when the Terminal window is resized while a program other than the shell is running in the foreground (less, vim,...). After terminating the program the described behavior can be observed. Apparently bash/readline doesn't re-get the terminal window size for some reason. Might be a bug in the bash/readline version we're using or just in the Haiku port.