Better check for displaying completions near the minibuffer.

* lisp/minibuffer.el (minibuffer-completion-help): Compare
selected-window with minibuffer-window to check whether
completions should be displayed near the minibuffer.
http://lists.gnu.org/archive/html/emacs-devel/2014-12/msg00311.html

Fixes: debbugs:17809
Better support for milti-line shell input.

* lisp/comint.el (comint-history-isearch-search)
(comint-history-isearch-wrap): Use field-beginning instead of
comint-line-beginning-position.
(comint-send-input): Go to the end of the field instead of the end
of the line to accept whole multi-line input.
http://lists.gnu.org/archive/html/emacs-devel/2014-12/msg00305.html