Fix for crash while editing multiple lines requested in issue #143
Squashed commit of the following:

commit 5b7659ec3d5e67b8dad8d3543d87a0169dc9a9e9
Merge: 57f3df3 22a4cd6
Author: ridiculousfish <corydoras@ridiculousfish.com>
Date:   Thu Jun 21 10:15:41 2012 -0700

    Merge branch 'master' of https://github.com/maxfl/fish-shell into maxfl-master-base

commit 22a4cd686fbe4a6730859aa1a84b21bc9c832203
Author: maxfl <gmaxfl@gmail.com>
Date:   Tue Jun 19 15:51:43 2012 +0400

    set now expands the variable size, if index is outside it

commit 9b0ffa83157ce0cfa36d246fa2e3179d6b790dea
Author: maxfl <gmaxfl@gmail.com>
Date:   Mon Jun 18 21:30:44 2012 +0400

    fixes #78

commit 78387fb3915b01342a981059780a164eedc0f8eb
Merge: c0e6096 93dc7d4
Author: maxfl <gmaxfl@gmail.com>
Date:   Mon Jun 18 21:27:47 2012 +0400

    Merge remote-tracking branch 'fishfish/master'

commit c0e60963c179f80cb1d5d6a18b44510e55c95e10
Merge: 32a98e7 1bead8a
Author: maxfl <gmaxfl@gmail.com>
Date:   Mon Jun 18 10:29:42 2012 +0400

    Merge remote-tracking branch 'fishfish/master'

commit 32a98e799eb2f016f8bad5287851f6353b835014
Merge: 6e71021 f2b5292
Author: maxfl <gmaxfl@gmail.com>
Date:   Sat Jun 16 18:42:07 2012 +0400

    Merge remote-tracking branch 'fishfish/master'

commit 6e710211bca0bca73d738d71e22d20e700db2a63
Author: maxfl <gmaxfl@gmail.com>
Date:   Thu Jun 14 11:01:13 2012 +0400

    revert fish_pager

commit 731a29f35bdbaa4dfaad78c7428ab2e5edb45a6c
Author: maxfl <gmaxfl@gmail.com>
Date:   Thu Jun 14 10:57:41 2012 +0400

    revert fish_pager.cpp

commit 72c1bfc7bfa77bb723d6df3f030a1918db2aca8a
Merge: ea74ffa 9b781c4
Author: maxfl <gmaxfl@gmail.com>
Date:   Wed Jun 13 17:54:11 2012 +0400

    Merge branch 'master' into maxfl_completions

commit ea74ffa08689a35fd08bc3520a0d52cf30365568
Author: maxfl <gmaxfl@gmail.com>
Date:   Wed Jun 13 17:35:20 2012 +0400

    __fish_complete_command now can understand '--arg=option' tokens
    latexmk completion is updated

commit 45b667826f3f181972e4987a3609d4ccac16a675
Author: maxfl <gmaxfl@gmail.com>
Date:   Wed Jun 13 16:46:47 2012 +0400

    . completion

commit 1c9f8ffc9e7ea45eee8aedba5a48e21c75a08882
Author: maxfl <gmaxfl@gmail.com>
Date:   Wed Jun 13 16:46:13 2012 +0400

    a lot of new completions

commit 8224d9f984a678fd49cdf78f76770977e0ae257b
Author: Maxim Gonchar <gonchar@myhost.localdomain>
Date:   Tue Jun 12 20:19:31 2012 +0400

    A lot of new completions.
    Some small updates and fixes of old functions and completions.

commit 234ed8f5dab209fd657ccaf0dd23d636d2a06355
Author: Maxim Gonchar <gonchar@myhost.localdomain>
Date:   Tue Jun 12 20:03:44 2012 +0400

    step-coloring initial
    set_color correction
Enable window title update when TERM is screen-X

	* Uses the same logic as when TERM is
	  xterm-X to enable window-title updates when
	  running in screen.
Fixes title update in tmux and screen

	* Seems that writestr( L"\x1b];" ); doesn't work in tmux and
	  screen. As discussed in fish-shell/fish-shell#47 the 2 was
	  removed. This commit adds the zero (L"\x1b]0;").
	* Tested in screen,tmux,iTerm and xterm.
Replace __fish_git_branch_prompt.fish with __fish_git_prompt.fish

__fish_git_prompt.fish is a complete port of the __git_ps1 function from
git-completion.bash, with the relevant configuration variables changed
and some extra configuration added (namely, control over individual
colors and the status indicator characters).
Tweak documentation for __fish_git_prompt

Add mention of the __fish_git_prompt_color variable.
Merge pull request #169 from kballard/git_prompt_docs

Tweak documentation for __fish_git_prompt
Mostly fix https://github.com/fish-shell/fish-shell/issues/72
Fixed declaration of wrealpath() function on FreeBSD
Add a test case for switch error code (issue #161)
Don't blow away $status in switch statements

Tweak the switch and case builtins to not blow away $status
inappropriately. Fixes issue #161.
Fix var set in __fish_config_interactive.fish

__fish_config_interactive.fish uses the presence of __fish_init_1_50_0
to decide whether it should perform a one-time initialization of
universal variables. Unfortunately, it sets the variable
__fish_init_1_23_0. Fix this to set __fish_init_1_50_0 instead.
Fix prompt_cwd on darwin systems when $PWD is "/private"

When $PWD is "/private", the prompt was printing "rivate". Skip the
"/private" stripping if there's nothing after it.

Prevent "/private" from being stripped anywhere but the beginning of the
PWD.

Fixes #173
Bring prompt_pwd under Darwin to parity with non-Darwin

The echo command to print the last path segment got a couplel of fixes,
but these fixes were only applied to the non-Darwin version. Copy these
fixes over to the Darwin version. Notably, this makes `/` stop
displaying as `//`.
Fixed crash caused by pressing pageup button