FIXED: oneliner note entries caused breaked displaying in interactive

mode.
FIXED:          list displaying in interactiv mode corrected. the width of the
                note number will now correctly used.
CHANGED:        the default setting of note will now be to use an external
                editor instead of stdin.
CHANGED:        the unneccessary apostrophes in listings has been removed.
ADDED:          the note version will be displayed in the titlebar of interactive
                mode.
ADDED:          new config variable AutoClear, which is turned on by default,
                which controls wether the screen shall be cleared after each
                item (display, list and so on).
This commit is contained in:
TLINDEN
2012-02-10 20:28:49 +01:00
parent 6c4ca1167c
commit 850a892bfb
7 changed files with 58 additions and 26 deletions

View File

@@ -1,3 +1,18 @@
================================================================================
1.2.2:
FIXED: oneliner note entries caused breaked displaying in interactive
mode.
FIXED: list displaying in interactiv mode corrected. the width of the
note number will now correctly used.
CHANGED: the default setting of note will now be to use an external
editor instead of stdin.
CHANGED: the unneccessary apostrophes in listings has been removed.
ADDED: the note version will be displayed in the titlebar of interactive
mode.
ADDED: new config variable AutoClear, which is turned on by default,
which controls wether the screen shall be cleared after each
item (display, list and so on).
================================================================================ ================================================================================
1.2.1: 1.2.1:
CHANGED: added the correct installation instructions to the README file. CHANGED: added the correct installation instructions to the README file.

4
README
View File

@@ -1,4 +1,4 @@
note 1.2.1 by Thomas Linden, 03/03/2003 note 1.2.2 by Thomas Linden, 04/03/2003
======================================= =======================================
Introduction Introduction
@@ -202,4 +202,4 @@ and I'll add you.
Last changed Last changed
============ ============
03/03/2003 04/03/2003

10
TODO
View File

@@ -1,3 +1,7 @@
o mysql.pm und dbm.pm generate_search testen! - &output() has to be rewritten, its a historically
o Website anpassen growed mutant.
o Announcement on freshmeat.
- ncurses support
- readline/editline support for interactive prompt
with: completion and history

View File

@@ -1 +1 @@
1.2.0 1.2.2

View File

@@ -72,7 +72,7 @@ my (
$ALWAYS_INT, $KEEP_TIMESTAMP, $COLOR, $ALWAYS_EDIT, $HOME, $FormatText, $ALWAYS_INT, $KEEP_TIMESTAMP, $COLOR, $ALWAYS_EDIT, $HOME, $FormatText,
$BORDER_COLOR, $NOTE_COLOR, $NUM_COLOR, $TOPIC_COLOR, $MAX_NOTE, $BORDER_COLOR, $NOTE_COLOR, $NUM_COLOR, $TOPIC_COLOR, $MAX_NOTE,
$USE_CRYPT, $CRYPT_METHOD, $TopicSep, $DEFAULT_LIST, $TIME_COLOR, $SHORT_CD, $USE_CRYPT, $CRYPT_METHOD, $TopicSep, $DEFAULT_LIST, $TIME_COLOR, $SHORT_CD,
$USE_CACHE, $USE_CACHE, $AUTO_CLEAR,
# #
# db specifics from .noterc # db specifics from .noterc
@@ -126,7 +126,7 @@ $TIME_COLOR = "blue";
$TOPIC_COLOR = "bold"; $TOPIC_COLOR = "bold";
$TOPIC = 1; $TOPIC = 1;
$TopicSep = '/'; $TopicSep = '/';
$version = "1.2.1"; $version = "1.2.2";
if ($TOPIC) { if ($TOPIC) {
$CurDepth = 1; # the current depth inside the topic "directory" structure... $CurDepth = 1; # the current depth inside the topic "directory" structure...
} }
@@ -138,6 +138,8 @@ $fnote = "note";
$fdate = "date"; $fdate = "date";
$fnum = "number"; $fnum = "number";
$ALWAYS_INT = "YES"; $ALWAYS_INT = "YES";
$ALWAYS_EDIT = "YES";
$AUTO_CLEAR = "YES";
# colors available # colors available
# \033[1m%30s\033[0m # \033[1m%30s\033[0m
@@ -914,15 +916,15 @@ sub determine_width {
eval { eval {
my $wide = `stty -a`; my $wide = `stty -a`;
if ($wide =~ /columns (\d+?);/) { if ($wide =~ /columns (\d+?);/) {
$maxlen = $1 - 33; # (33 = timestamp + borders) $maxlen = $1 - 32; # (32 = timestamp + borders)
} }
elsif ($wide =~ /; (\d+?) columns;/) { elsif ($wide =~ /; (\d+?) columns;/) {
# bsd # bsd
$maxlen = $1 - 33; # (33 = timestamp + borders) $maxlen = $1 - 32; # (32 = timestamp + borders)
} }
else { else {
# stty didn't work # stty didn't work
$maxlen = 80 - 33; $maxlen = 80 - 32;
} }
}; };
} }
@@ -930,6 +932,7 @@ sub determine_width {
sub clear { sub clear {
# first, try to determine the terminal height # first, try to determine the terminal height
return if(!$AUTO_CLEAR);
my $hoch; my $hoch;
eval { eval {
my $height = `stty -a`; my $height = `stty -a`;
@@ -1197,39 +1200,41 @@ sub format {
sub output { sub output {
my($SSS, $LINE, $num, $note, $time, $TYPE, $L, $LONGSPC, $R, $PathLen, $SP, $title, $CUTSPACE, my($SSS, $LINE, $num, $note, $time, $TYPE, $L, $LONGSPC, $R, $PathLen, $SP, $title, $CUTSPACE,
$len, $diff, $Space, $nlen, $txtlen, $count); $VersionLen, $len, $diff, $Space, $nlen, $txtlen, $count);
($num, $note, $time, $TYPE, $count) = @_; ($num, $note, $time, $TYPE, $count) = @_;
$txtlen = ($ListType eq "LONG") ? $maxlen : $timelen + $maxlen; $txtlen = ($ListType eq "LONG") ? $maxlen : $timelen + $maxlen;
$note = &format($note); $note = &format($note);
$SSS = "-" x ($maxlen + 31); $SSS = "-" x ($maxlen + 30);
$nlen = length("$num"); $nlen = length("$num");
$LINE = "$BORDERC $SSS $_BORDERC\n"; $LINE = "$BORDERC $SSS $_BORDERC\n";
$L = $BORDERC . "[" . $_BORDERC; $L = $BORDERC . "[" . $_BORDERC;
$LONGSPC = " " x (26 - $nlen); $LONGSPC = " " x (25 - $nlen);
$R = $BORDERC . "]" . $_BORDERC; $R = $BORDERC . "]" . $_BORDERC;
$PathLen = length($PATH); # will be ZERO, if not in TOPIC mode! $PathLen = length($PATH); # will be ZERO, if not in TOPIC mode!
$VersionLen = length($version) + 7;
if ($TYPE ne "SINGLE") { if ($TYPE ne "SINGLE") {
if (!$SetTitle) { if (!$SetTitle) {
$SP = ""; $SP = "";
# print only if it is the first line! # print only if it is the first line!
$SP = " " x ($maxlen - 2 - $PathLen); $SP = " " x ($maxlen - 2 - $PathLen - $VersionLen);
if (!$Raw) { if (!$Raw) {
# no title in raw-mode! # no title in raw-mode!
print C $LINE; print C $LINE;
print C "$L $NUMC#$_NUMC "; print C "$L $NUMC#$_NUMC ";
if ($ListType eq "LONG") { if ($ListType eq "LONG") {
print C " $TIMEC" . "creation date$_TIMEC "; print C " $TIMEC" . "creation date$_TIMEC ";
} }
else { else {
print $LONGSPC; print $LONGSPC;
} }
if ($TOPIC) { if ($TOPIC) {
print C $TOPICC . "$PATH $_TOPICC$SP$R\n"; print C $TOPICC . "$PATH $_TOPICC$SP" . " note $version $R\n";
} }
else { else {
print C $NOTEC . "note$_NOTEC$SP$R\n"; print C $NOTEC . "note$_NOTEC$SP" . " note $version $R\n";
} }
print C $LINE; print C $LINE;
} }
@@ -1244,13 +1249,14 @@ sub output {
$len = length($note); $len = length($note);
if ($len < ($txtlen - 2 - $nlen)) { if ($len < ($txtlen - 2 - $nlen)) {
$diff = $txtlen - $len; $diff = $txtlen - $len;
$Space = " " x $diff;
if (!$Raw) { if (!$Raw) {
if ($num eq "-") { if ($num eq "-") {
$title = $BORDERC . $TOPICC . "\"" . $note . "\"" . $_TOPICC . $Space . "$_BORDERC"; $Space = " " x $diff;
$title = $BORDERC . $TOPICC . $note . " " . $_TOPICC . $Space . "$_BORDERC";
} }
else { else {
$title = $BORDERC . $NOTEC . "\"" . $note . "\"" . $_NOTEC . $Space . "$_BORDERC"; $Space = " " x ($diff - ($nlen - 1));
$title = $BORDERC . $NOTEC . $note . " " . $_NOTEC . $Space . "$_BORDERC";
} }
} }
else { else {
@@ -1260,7 +1266,7 @@ sub output {
else { else {
$title = substr($note,0,($txtlen - 2 - $nlen)); $title = substr($note,0,($txtlen - 2 - $nlen));
if (!$Raw) { if (!$Raw) {
$title = $BORDERC . $NOTEC . "\"" . $title . "...\"$_NOTEC$_BORDERC"; $title = $BORDERC . $NOTEC . $title . "... $_NOTEC$_BORDERC";
} }
} }
if ($Raw) { if ($Raw) {
@@ -1284,7 +1290,7 @@ sub output {
else { else {
# we will not reach this in raw-mode, therefore no decision here! # we will not reach this in raw-mode, therefore no decision here!
chomp $note; chomp $note;
$Space = " " x (($maxlen + $timelen) - 16); $Space = " " x (($maxlen + $timelen) - $nlen - 16);
print C $LINE; print C $LINE;
print C "$L $NUMC$num$_NUMC $R$L$TIMEC$time$_TIMEC $Space$R\n"; print C "$L $NUMC$num$_NUMC $R$L$TIMEC$time$_TIMEC $Space$R\n";
print "\n"; print "\n";
@@ -1546,6 +1552,7 @@ sub getconfig
$ALWAYS_EDIT = undef if (/^AlwaysEditor/ && $value == 0); $ALWAYS_EDIT = undef if (/^AlwaysEditor/ && $value == 0);
$KEEP_TIMESTAMP = "YES" if (/^KeepTimeStamp/ && $value == 1); $KEEP_TIMESTAMP = "YES" if (/^KeepTimeStamp/ && $value == 1);
$KEEP_TIMESTAMP = undef if (/^KeepTimeStamp/ && $value == 0); $KEEP_TIMESTAMP = undef if (/^KeepTimeStamp/ && $value == 0);
$AUTO_CLEAR = "YES" if (/^AutoClear/ && $value == 1);
$COLOR = "YES" if (/^UseColors/ && $value == 1); $COLOR = "YES" if (/^UseColors/ && $value == 1);
$COLOR = "NO" if (/^UseColors/ && $value == 0); $COLOR = "NO" if (/^UseColors/ && $value == 0);
$TopicSep = $value if (/^TopicSeparator/); $TopicSep = $value if (/^TopicSeparator/);
@@ -1560,6 +1567,7 @@ sub getconfig
$TempDir = $value if (/^TempDirectory/); $TempDir = $value if (/^TempDirectory/);
$USE_CACHE = $value if (/^Cache/); $USE_CACHE = $value if (/^Cache/);
$time_format = $value if (/^TimeFormat/); $time_format = $value if (/^TimeFormat/);
$AUTO_CLEAR = $value if (/^AutoClear/);
} }
chomp $home; chomp $home;
$home =~ s/\/*$//; # cut eventually / at the end $home =~ s/\/*$//; # cut eventually / at the end

View File

@@ -1,10 +1,10 @@
# 1.1.2 -*- sh -*- # 1.2.2 -*- sh -*-
# This is a sample config for the note script # This is a sample config for the note script
# There are useful defaults set in note itself. # There are useful defaults set in note itself.
# #
# Copy it to your $HOME as .noterc # Copy it to your $HOME as .noterc
# #
# note is Copyright (c) 1999-2000 Thomas Linden. # note is Copyright (c) 1999-2003 Thomas Linden.
# You can contact me per email: <tom@daemon.de> # You can contact me per email: <tom@daemon.de>
# #
# comments start with #, empty lines will be ignored. # comments start with #, empty lines will be ignored.
@@ -120,6 +120,11 @@ TopicSeparator /
MaxLen auto MaxLen auto
# Set this to 0 if you dont want note to automatically
# clear the screen after displaying something and after
# exit (feature introduced in 1.2.1).
AutoClear 1
# note can use colors for output, set this option to # note can use colors for output, set this option to
# 1, if you don't want it, or if your terminal does # 1, if you don't want it, or if your terminal does
# not support it, set to 0. The default is 1 (on). # not support it, set to 0. The default is 1 (on).

View File

@@ -503,6 +503,6 @@ Thomas Linden <tom@daemon.de>
=head1 VERSION =head1 VERSION
1.2.1 (03/03/2003) 1.2.2 (04/03/2003)
=cut =cut