Using mvvline
I can draw vertical line from top to bottom. I need to draw line from bottom to top. How can it be done?
Asked
Active
Viewed 483 times
0

Jonathan Leffler
- 730,956
- 141
- 904
- 1,278

David Frucht
- 23
- 4
-
What's the difference? – rici Jun 22 '19 at 17:37
-
Imagine a turtle like the old logo programing language . The user input direction of the turtle to go and draw... – David Frucht Jun 22 '19 at 17:50
-
sure but the user can't see the direction the line is being drawn. If you want to draw a line extending `n` rows up starting at row `y`, you can draw a line `n` rows down starting at row `y - n + 1`. – rici Jun 22 '19 at 17:56
-
I guess you might need to move the cursor afterwards, if you might need the cursor position to be correct. I could wrap that into a few lines of code if it's not obvious. – rici Jun 22 '19 at 18:17
-
According to the Linux man page for [`mvvline()`](https://linux.die.net/man/3/mvvline), there is also a function `vline()` which doesn't move the cursor (it draws from the current position). Presumably, you should use that when appropriate. Or maybe you should always use it and move the cursor to the appropriate start position before and end position after using it. It probably means writing your own function to do the drawing the way you want — at least, if you draw vertical lines from more than one place in your code. If there's only one place then you could avoid creating a new function. – Jonathan Leffler Jun 23 '19 at 06:48