Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.development.apps > #532

Re: Set/get console cursor position without use ncurses

From GangGreene <GangGreene@example.com>
Newsgroups comp.os.linux.development.apps
Subject Re: Set/get console cursor position without use ncurses
Date 2012-11-21 07:48 -0500
Organization A noiseless patient Spider
Message-ID <76vun9-d2d.ln1@crazy-horse.bildanet.com> (permalink)
References (2 earlier) <k8dlao$ju1$1@speranza.aioe.org> <k8dth1$4bp$1@dont-email.me> <k8fi39$e4j$1@speranza.aioe.org> <1bhaokyvez.fsf@snowball.wb.pfeifferfamily.net> <k8i6at$pdu$1@speranza.aioe.org>

Show all headers | View raw


On Wed, 21 Nov 2012 09:19:25 +0000, Max wrote:

> Joe Pfeiffer wrote:
> 
>> If you want to target both linux and DOS, ncurses moves from being the
>> right way to do it to being really the right way to do it.  At worst,
>> for linux, you need to bundle a version of ncurses with your
>> application.  For DOS, it turns out there is a library called PDCurses
>> which works pretty much the same way (according to wikipedia, anyway --
>> I've never used it, unlike ncurses).  Any platform-dependency you need
>> to insert in your code will be an order of magnitude easier if it's
>> between two similar libraries instead of between a platform that comes
>> close to emulating a terminal and one that's Completely Different.
> 
> As replied in another post of this same thread there is no need of
> ncurses (or similar libraries) functionalities under DOS or Windows. All
> the function for easily move the cursor position and a lot of other
> graphic functions are available through interrupt calls (DOS) or direct
> API calls (Windows). Under Linux it seem ncurses is the only way to get
> easily what in other OS is natively available without additional efforts
> or libraries...


## Screen Dimensions
# Find current screen size
if [ -z "${COLUMNS}" ]; then
   COLUMNS=$(stty size)
   COLUMNS=${COLUMNS##* }
fi

# When using remote connections, such as a serial port, stty size returns 
0
if [ "${COLUMNS}" = "0" ]; then 
   COLUMNS=80
fi

## Measurements for positioning result messages
COL=$((${COLUMNS} - 8))
WCOL=$((${COL} - 2))

## Set Cursor Position Commands, used via $ECHO
SET_COL="\\033[${COL}G"      # at the $COL char
SET_WCOL="\\033[${WCOL}G"    # at the $WCOL char
CURS_UP="\\033[1A\\033[0G"   # Up one line, at the 0'th char

Back to comp.os.linux.development.apps | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Set/get console cursor position without use ncurses "Max" <noname@noreply.com> - 2012-11-19 08:15 +0000
  Re: Set/get console cursor position without use ncurses Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2012-11-19 12:42 +0200
    Re: Set/get console cursor position without use ncurses "Max" <noname@noreply.com> - 2012-11-19 16:04 +0000
      Re: Set/get console cursor position without use ncurses Grant Edwards <invalid@invalid.invalid> - 2012-11-19 16:13 +0000
        Re: Set/get console cursor position without use ncurses Chris Cox <chrisncoxn@endlessnow.com> - 2012-11-19 15:41 -0600
          Re: Set/get console cursor position without use ncurses Grant Edwards <invalid@invalid.invalid> - 2012-11-19 22:43 +0000
            Re: Set/get console cursor position without use ncurses "Max" <noname@noreply.com> - 2012-11-20 09:28 +0000
              Re: Set/get console cursor position without use ncurses Chris Cox <chrisncoxn@endlessnow.com> - 2012-11-20 09:14 -0600
                Re: Set/get console cursor position without use ncurses Brian Bebeau <bbebeau@computer.org> - 2012-11-21 15:56 -0500
      Re: Set/get console cursor position without use ncurses Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-11-19 09:55 -0700
        Re: Set/get console cursor position without use ncurses "Max" <noname@noreply.com> - 2012-11-20 09:31 +0000
          Re: Set/get console cursor position without use ncurses Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2012-11-20 15:17 +0200
      Re: Set/get console cursor position without use ncurses Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2012-11-19 20:24 +0200
        Re: Set/get console cursor position without use ncurses "Max" <noname@noreply.com> - 2012-11-20 09:21 +0000
          Re: Set/get console cursor position without use ncurses Chris Cox <chrisncoxn@endlessnow.com> - 2012-11-20 09:35 -0600
            Re: Set/get console cursor position without use ncurses "Max" <noname@noreply.com> - 2012-11-20 15:52 +0000
          Re: Set/get console cursor position without use ncurses Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-11-20 11:35 -0700
            Re: Set/get console cursor position without use ncurses "Max" <noname@noreply.com> - 2012-11-21 09:19 +0000
              Re: Set/get console cursor position without use ncurses Jan Panteltje <pNaonStpealmtje@yahoo.com> - 2012-11-21 09:34 +0000
                Re: Set/get console cursor position without use ncurses "Max" <noname@noreply.com> - 2012-11-21 10:59 +0000
                Re: Set/get console cursor position without use ncurses Jan Panteltje <pNaonStpealmtje@yahoo.com> - 2012-11-21 11:54 +0000
                Re: Set/get console cursor position without use ncurses Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-11-21 16:43 +0000
                Re: Set/get console cursor position without use ncurses "Max" <noname@noreply.com> - 2012-11-22 08:30 +0000
                Re: Set/get console cursor position without use ncurses Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-11-22 13:14 +0000
                Re: Set/get console cursor position without use ncurses "Max" <noname@noreply.com> - 2012-11-22 14:08 +0000
                Re: Set/get console cursor position without use ncurses John Hasler <jhasler@newsguy.com> - 2012-11-22 10:06 -0600
                Re: Set/get console cursor position without use ncurses Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-11-22 16:31 +0000
                Re: Set/get console cursor position without use ncurses "Max" <noname@noreply.com> - 2012-11-23 09:11 +0000
                Re: Set/get console cursor position without use ncurses Jan Panteltje <pNaonStpealmtje@yahoo.com> - 2012-11-23 09:36 +0000
                Re: Set/get console cursor position without use ncurses "Max" <noname@noreply.com> - 2012-11-23 16:27 +0000
                Re: Set/get console cursor position without use ncurses Jan Panteltje <pNaonStpealmtje@yahoo.com> - 2012-11-23 20:13 +0000
                Re: Set/get console cursor position without use ncurses Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-11-23 14:54 +0000
                Re: Set/get console cursor position without use ncurses John Hasler <jhasler@newsguy.com> - 2012-11-22 08:03 -0600
                Re: Set/get console cursor position without use ncurses morey4857@gmail.com - 2016-08-18 22:48 -0700
              Re: Set/get console cursor position without use ncurses GangGreene <GangGreene@example.com> - 2012-11-21 07:48 -0500
              Re: Set/get console cursor position without use ncurses John Hasler <jhasler@newsguy.com> - 2012-11-21 08:24 -0600
                Re: Set/get console cursor position without use ncurses "Max" <noname@noreply.com> - 2012-11-21 14:45 +0000
                Re: Set/get console cursor position without use ncurses John Hasler <jhasler@newsguy.com> - 2012-11-21 11:11 -0600
              Re: Set/get console cursor position without use ncurses Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-11-21 10:20 -0700
              Re: Set/get console cursor position without use ncurses Grant Edwards <invalid@invalid.invalid> - 2012-11-21 17:23 +0000
  Re: Set/get console cursor position without use ncurses Grant Edwards <invalid@invalid.invalid> - 2012-11-19 15:38 +0000
    Re: Set/get console cursor position without use ncurses Joe Beanfish <joebeanfish@nospam.duh> - 2012-11-20 14:05 +0000
  Re: Set/get console cursor position without use ncurses Richard Kettlewell <rjk@greenend.org.uk> - 2012-11-21 11:30 +0000
  Re: Set/get console cursor position without use ncurses Ron House <rhouse@smartchat.net.au> - 2013-07-11 13:56 +1000
    Re: Set/get console cursor position without use ncurses Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-07-11 11:08 +0100

csiph-web