Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scrip to better obtain console dimensions #7

Open
scottfurry opened this issue Dec 15, 2023 · 1 comment
Open

Update scrip to better obtain console dimensions #7

scottfurry opened this issue Dec 15, 2023 · 1 comment

Comments

@scottfurry
Copy link

Recently moved from a Linux to FreeBSD system. Executing script resulted in "recursion" errors pointing to usage of columns variable. Eventually came to realize that columns and lines variables were not being properly populated during execution.

After review of stty man page for FreeBSD, I was able to come up with a more robust method of obtaining terminal sizing.

Review of Debian stty man page leads me to believe that this change should work there as well.

Solution is to explictly call for terminal sizing from stty via an attribute. This boils down to change of one line. Change works locally.

This effort may also close #6 but should be tested. I was not able to locate a conical reference for stty for MacOS. Only reference I could find is here

diff --git a/redoflacs b/redoflacs
index 92079c4..a1711b5 100755
--- a/redoflacs
+++ b/redoflacs
@@ -543,8 +543,8 @@ _scroll_terminal()
   declare -g columns
 
   # Redirecting '/dev/stderr' to 'stty' allows valid arguments
-  read -r _ _ _ _ lines _ columns _ < <(stty -a < /dev/stderr)
-
+  # read -r _ _ _ _ lines _ columns _ < <(stty -a < /dev/stderr)
+  read -r lines columns < <(stty size < /dev/stderr)
   columns="${columns%;}"   # Terminal width - remove trailing semicolon
   lines="${lines%;}"       # Terminal height - remove trailing semicolon
@scottfurry
Copy link
Author

Bumping for awareness...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant