[lastbash-cvs] lastbash lastbash,1.86,1.87
Status: Beta
Brought to you by:
cstroie
|
From: Costin S. <cs...@us...> - 2006-12-06 23:06:10
|
Update of /cvsroot/lastbash/lastbash In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21404 Modified Files: lastbash Log Message: Added a experimental way of displaying history line, to fix the unicode truncation. Index: lastbash =================================================================== RCS file: /cvsroot/lastbash/lastbash/lastbash,v retrieving revision 1.86 retrieving revision 1.87 diff -u -d -r1.86 -r1.87 --- lastbash 6 Dec 2006 17:35:56 -0000 1.86 +++ lastbash 6 Dec 2006 23:05:39 -0000 1.87 @@ -1092,6 +1092,62 @@ tput csr 0 ${T_LINES} } +# Function: Display the line in history area, using column positioning {{{1 +#----------------------------------------------------------------------------- +function tui_history_line_col() +{ + # $1 - index in HISTORY array + + local FIELD LINE S C + + # Clear the line + LINE="${T_EL}" + + # Move to column + C="1" + LINE="${LINE}$(tput hpa $C)" + + # Start with the love/ban indicator + if [ "${HISTORY_ACTION[$1]}" ] + then + LINE="${LINE}${HISTORY_ACTION[$1]:0:1}" + else + LINE="${LINE} " + fi + + # Add the artist, if the field units are not null + if [ "${HISTORY_FIELD_UNITS[0]}" != "0" ] + then + C=$(( C + 3 )) + S="${HISTORY_FIELD_SIZE[0]}" + printf -v FIELD "%-${S}s" "${HISTORY_ARTIST[$1]:0:$S}" + LINE="${LINE}$(tput hpa $C)${FIELD}" + fi + + # Add the album, if the field units are not null + if [ "${HISTORY_FIELD_UNITS[1]}" != "0" ] + then + C=$(( C + S + 2 )) + S="${HISTORY_FIELD_SIZE[1]}" + printf -v FIELD "%-${S}s" "${HISTORY_ALBUM[$1]:0:$S}" + LINE="${LINE}$(tput hpa $C)${FIELD}" + fi + + # Add the track title + C=$(( C + S + 2 )) + S="${HISTORY_FIELD_SIZE[2]}" + printf -v FIELD "%-${S}s" "${HISTORY_TRACK[$1]:0:$S}" + LINE="${LINE}$(tput hpa $C)${FIELD}" + + # Add the track duration + C=$(( C + S + 2 )) + printf -v FIELD "%6s " "${HISTORY_MIN_SEC[$1]}" + LINE="${LINE}$(tput hpa $C)${FIELD}" + + # Output the line + echo -n "${LINE}" +} + # Function: Display the line in history area {{{1 #----------------------------------------------------------------------------- function tui_history_line() |