timcharper/evil-surround — pull request #31 by yuriaisaka (2014-06-16 05:53:19+00:00)
Title: Improve surround-outer-overlay and surround-inner-overlay (issue/30)

## Synopsis
A trivial patch to prevent cs' etc. to slurp trailing newlines.

## Patch
**Modifies `surround-outer/inner-overlay`.**

Issuing `cs"'` leads to the call chain `surround-outer-overlay` -> `evil-a-single-quote` (via `evil-outer-text-objects-map`) -> `evil-quote-range`, and `evil-quote-range` adds trailing "spaces" to `outer` (its return value) by using `(looking-at "[[:space:]]+")`.

The current implementation of `surround-outer-overlay` tries to undo this operation by calling `(surround-trim-whitespace-from-range outer "[ \t]")`, which, when `[:space:]` includes newlines (text-mode, html-mode etc.), leads to the "unwanted" behaviour described in the [issue/30](https://github.com/timcharper/evil-surround/issues/30).

The simplest fix (which this patch does) is to replace `"[ \t]"` by `"[[:space:]]"`. The same fix for `surround-inner-overlay` makes it behave "better".