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/life.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/life.vim')
| -rw-r--r-- | autoload/space_vlaze/life.vim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/autoload/space_vlaze/life.vim b/autoload/space_vlaze/life.vim index 4168a74..400ec01 100644 --- a/autoload/space_vlaze/life.vim +++ b/autoload/space_vlaze/life.vim @@ -28,5 +28,7 @@ function! space_vlaze#life#RenderLives() let i += 1 endwhile - call setline(lives_line, lives_display) + let lives_padding = space_vlaze#padding#RightPadding(lives_display) + + call setline(lives_line, lives_display . lives_padding) endfunction |
