Find longest consecutive characters in 2D array

Charcoal, 110 bytes

≔⪫Ａ⸿θＰθＦθ«≔⟦⟧ηＦ∧¬№0⸿ι⟦→↘↓↙⟧«≔ＫＤＬθ✳κζＷ›Ｌζ№ζι≔⊟ζε⊞η⟦κιＬζ⟧»¿⁼¹⌈Ｅη§κ²⊞υ⊟ηＦη⊞υκι»⎚≔⌈Ｅυ§ι²εＦΦυ⁼⊟ιε«⊟ι,Ｉε,Ｐ✳⊟ι⎇⊖ε¹.¦⸿


Try it online! Link is to verbose version of code. Takes an array of strings as input. Explanation:

≔⪫Ａ⸿θＰθ


Join the strings with carriage returns (not newlines) and output them without moving the cursor.

Ｆθ«


Loop over each character in the string.

≔⟦⟧η


Collect all of the consecutive characters starting at this position in an array.

Ｆ∧¬№0⸿ι⟦→↘↓↙⟧«


If the current character is not a 0 or a carriage return, then check all four directions.

≔ＫＤＬθ✳κζ


Peek as much as possible in that direction.

Ｗ›Ｌζ№ζι≔⊟ζε


Shorten the string until all of the characters are the same.

⊞η⟦κιＬζ⟧»


Save the results in the array.

¿⁼¹⌈Ｅη§κ²⊞υ⊟ηＦη⊞υκ


If the maximum consecutive character was 1, then only push one of the results to the final array, otherwise push all of them.

ι»


Reprint the current character, this time allowing the cursor to move.

⎚


Clear the input from the canvas.

≔⌈Ｅυ§ι²ε


Find the longest consecutive length.

ＦΦυ⁼⊟ιε«


Loop over the entries with that length.

⊟ι,Ｉε,


Output the character and length.

Ｐ✳⊟ι⎇⊖ε¹.¦⸿


If the length is 1 then output a . otherwise output a direction character. Then move to the start of the next line for the next result.

Jelly, 52 54 bytes

,UŒD€;,Z$ṣ€€”0ŒrẎ€⁺;€"“\/-|”Ẏ2ị$ÐṀ¹F}ḟ”0;€1,”.ʋØ½œị’Ɗ?


Try it online!

A monadic link that takes a list of strings and returns. list of maximal outputs each in the order n, m, d. A third of the code is to deal with the requirement for dots (last example). Now handles Kevin Cruijssen’s edge case correctly.