diff options
| author | Teddy Wing | 2015-10-08 01:17:11 -0400 |
|---|---|---|
| committer | Teddy Wing | 2015-10-08 01:17:11 -0400 |
| commit | 2a0d95e135515b137a48d4b7b81ff01eaa664058 (patch) | |
| tree | bb2b4076310e2d98017b552f708c623d5194256d /autoload/space_vlaze/score.vim | |
| parent | ed38753948318b15bc82574bf25482d215e71a19 (diff) | |
| download | vim-space-vlaze-2a0d95e135515b137a48d4b7b81ff01eaa664058.tar.bz2 | |
Add space padding to Lives and Score lines
Pad these 2 status lines with spaces to the right of their string values
so that their background colours extend to the full width of the game
board.
First tried `len()`, then `strlen()` when counting characters in
`padding#RightPadding()` but turns out those deal with bytes and the
player character is a multi-byte character so we would come up sort on
spaces for padding in the Lives line because the player diamond counts
for double. To get around this, used `strchars()` which gives us a count
of the characters instead of the bytes.
Diffstat (limited to 'autoload/space_vlaze/score.vim')
| -rw-r--r-- | autoload/space_vlaze/score.vim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/autoload/space_vlaze/score.vim b/autoload/space_vlaze/score.vim index 612f02d..0debfaa 100644 --- a/autoload/space_vlaze/score.vim +++ b/autoload/space_vlaze/score.vim @@ -11,6 +11,8 @@ endfunction function! space_vlaze#score#RenderScore() let score_line = space_vlaze#game#BoardHeight() + 2 + let score_text = 'Score: ' . s:score + let score_padding = space_vlaze#padding#RightPadding(score_text) - call setline(score_line, 'Score: ' . s:score) + call setline(score_line, score_text . score_padding) endfunction |
